html[data-portal-direct-state="pending"] #dashboard-screen,
html[data-portal-direct-state="launching"] #dashboard-screen,
html[data-portal-direct-state="error"] #dashboard-screen,
html[data-portal-direct-state="pending"] #create-char-screen,
html[data-portal-direct-state="launching"] #create-char-screen,
html[data-portal-direct-state="error"] #create-char-screen {
  display: none !important;
}

/* A antiga HUD MMO continua no DOM apenas como contrato técnico para os
   módulos do jogo. Durante a inicialização ela nunca pode aparecer atrás do
   loading nem receber foco/cliques. O canvas só é revelado quando existe e já
   passou pelo período mínimo de estabilização controlado pelo host. */
html[data-portal-direct-state="pending"] #mmo-hud-viewport,
html[data-portal-direct-state="launching"] #mmo-hud-viewport,
html[data-portal-direct-state="error"] #mmo-hud-viewport,
html[data-portal-direct-state="pending"] #btn-fullscreen,
html[data-portal-direct-state="launching"] #btn-fullscreen,
html[data-portal-direct-state="error"] #btn-fullscreen,
html[data-portal-direct-state="pending"] #btn-padedit,
html[data-portal-direct-state="launching"] #btn-padedit,
html[data-portal-direct-state="error"] #btn-padedit,
html[data-portal-direct-state="pending"] #chat-box,
html[data-portal-direct-state="launching"] #chat-box,
html[data-portal-direct-state="error"] #chat-box,
html[data-portal-direct-state="pending"] #mobile-ui,
html[data-portal-direct-state="launching"] #mobile-ui,
html[data-portal-direct-state="error"] #mobile-ui {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

html[data-portal-direct-state="pending"] #boot-overlay,
html[data-portal-direct-state="launching"] #boot-overlay,
html[data-portal-direct-state="error"] #boot-overlay {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  z-index: 2147482500 !important;
}

html[data-portal-game-shell="true"] #boot-overlay {
  --portal-mint: #80f0c8;
  --portal-blue: #006c87;
  --portal-ink: #004b5f;
  background-color: #073b50 !important;
  background-image:
    linear-gradient(180deg, rgba(0, 75, 95, .08) 0%, rgba(0, 33, 49, .18) 42%, rgba(0, 20, 31, .76) 100%),
    url('/assets/brand/ultimate-poke-idle/loading-journey-background-v1-poster.webp?v=journey-video-1') !important;
  background-position: center !important;
  background-size: cover !important;
  box-sizing: border-box;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  font-family: "Exo 2", "Arial Narrow", system-ui, sans-serif !important;
}

html[data-portal-game-shell="true"] #boot-overlay .boot-background-video {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #073b50;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
}

html[data-portal-game-shell="true"] #boot-overlay::after {
  background:
    linear-gradient(90deg, rgba(0, 22, 36, .28), transparent 36%, rgba(0, 22, 36, .14)),
    linear-gradient(180deg, rgba(0, 75, 95, .02), rgba(0, 21, 32, .68)) !important;
}

html[data-portal-game-shell="true"] #boot-overlay .boot-embers {
  display: none !important;
}

html[data-portal-game-shell="true"] #boot-overlay .boot-center {
  box-sizing: border-box;
  flex: 0 0 auto;
  width: min(88vw, 720px) !important;
  margin-block: auto;
  padding: 34px clamp(28px, 5vw, 62px) 32px !important;
  overflow: visible;
  border: 1px solid rgba(196, 255, 237, .44) !important;
  border-radius: 34px 8px 34px 8px !important;
  background:
    linear-gradient(116deg, rgba(0, 43, 57, .93), rgba(0, 75, 95, .82) 58%, rgba(5, 47, 62, .88)) !important;
  box-shadow:
    0 9px 0 rgba(0, 108, 135, .78),
    0 28px 72px rgba(0, 15, 25, .48),
    inset 0 1px 0 rgba(255, 255, 255, .2) !important;
  backdrop-filter: blur(10px) saturate(1.14);
  clip-path: polygon(28px 0, calc(100% - 34px) 0, 100% 34px, 100% calc(100% - 28px), calc(100% - 28px) 100%, 28px 100%, 0 calc(100% - 28px), 0 28px);
}

html[data-portal-game-shell="true"] #boot-overlay .boot-center::before {
  content: "";
  width: min(58vw, 268px);
  height: 104px;
  margin: -10px 0 4px;
  background: url('/images/ultimate/brand/logo-horizontal-loading.webp') center / contain no-repeat;
  filter: drop-shadow(0 10px 18px rgba(0, 18, 29, .42));
}

html[data-portal-game-shell="true"] #boot-overlay .boot-center::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(128, 240, 200, .18) 0 2px, transparent 3px) 0 0 / 22px 22px,
    linear-gradient(90deg, var(--portal-mint), #50d6dd 56%, transparent) left top / 56% 5px no-repeat;
  opacity: .78;
}

html[data-portal-game-shell="true"] #boot-overlay .boot-emblem {
  display: none !important;
}

html[data-portal-game-shell="true"] #boot-overlay .boot-kicker {
  box-sizing: border-box;
  max-width: 100%;
  padding: 8px 28px 8px 34px;
  border-radius: 2px 18px 2px 18px;
  background: linear-gradient(90deg, var(--portal-mint), #9bf3dc);
  color: var(--portal-ink) !important;
  font-size: 10px !important;
  font-weight: 900 !important;
  letter-spacing: .14em !important;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
  box-shadow: 0 5px 0 rgba(0, 108, 135, .74);
}

html[data-portal-game-shell="true"] #boot-title {
  margin-top: 18px !important;
  color: #fff !important;
  font-size: clamp(28px, 4.6vw, 46px) !important;
  font-weight: 900 !important;
  font-style: italic;
  letter-spacing: .02em !important;
  line-height: .98 !important;
  text-align: center;
  text-shadow: 0 3px 0 var(--portal-ink), 0 12px 26px rgba(0, 0, 0, .35) !important;
  text-transform: uppercase;
}

html[data-portal-game-shell="true"] #boot-status {
  margin-top: 12px;
  color: #dffbf5 !important;
  font: 800 13px/1.45 system-ui, sans-serif !important;
  text-align: center;
}

html[data-portal-game-shell="true"] #boot-progress {
  box-sizing: border-box;
  width: 100%;
  height: 14px !important;
  margin-top: 24px;
  overflow: hidden;
  border: 2px solid rgba(223, 251, 245, .9) !important;
  border-radius: 999px !important;
  background: rgba(1, 25, 37, .76) !important;
  box-shadow: 0 8px 22px rgba(0, 19, 29, .3) !important;
}

html[data-portal-game-shell="true"] #boot-progress-fill {
  background: linear-gradient(90deg, var(--portal-mint), #54d9d1, #3ec1ee) !important;
  box-shadow: 0 0 18px rgba(128, 240, 200, .58) !important;
}

html[data-portal-game-shell="true"] #boot-progress.is-indeterminate #boot-progress-fill {
  width: 34% !important;
  animation: portal-loading-glide 1.25s cubic-bezier(.65, 0, .35, 1) infinite;
}

@keyframes portal-loading-glide {
  0% { transform: translateX(-125%); }
  100% { transform: translateX(390%); }
}

html[data-portal-game-shell="true"] .portal-loading-route {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: 100%;
  margin: 13px 0 0;
  color: rgba(223, 251, 245, .68);
}

html[data-portal-game-shell="true"] .portal-loading-route::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 9%;
  right: 9%;
  height: 2px;
  background: rgba(223, 251, 245, .22);
}

html[data-portal-game-shell="true"] .portal-loading-route__step {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 0;
  font: 800 9px/1 system-ui, sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
}

html[data-portal-game-shell="true"] .portal-loading-route__step::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid rgba(223, 251, 245, .66);
  border-radius: 50%;
  background: #053a4d;
  box-shadow: 0 0 0 4px rgba(5, 58, 77, .86);
}

html[data-portal-game-shell="true"] .portal-loading-route__step.is-complete,
html[data-portal-game-shell="true"] .portal-loading-route__step.is-active {
  color: #fff;
}

html[data-portal-game-shell="true"] .portal-loading-route__step.is-complete::before {
  border-color: var(--portal-mint);
  background: var(--portal-mint);
}

html[data-portal-game-shell="true"] .portal-loading-route__step.is-active::before {
  border-color: #fff;
  background: #3ec1ee;
  box-shadow: 0 0 0 4px rgba(62, 193, 238, .2), 0 0 20px rgba(128, 240, 200, .72);
}

html[data-portal-game-shell="true"] #boot-err-msg {
  color: #ffd89e !important;
}

html[data-portal-game-shell="true"] .portal-loading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

html[data-portal-game-shell="true"] .portal-loading-actions[hidden] {
  display: none !important;
}

html[data-portal-game-shell="true"] .portal-loading-actions button {
  min-height: 44px;
  padding: 10px 18px;
  border: 2px solid rgba(255, 255, 255, .86);
  border-radius: 999px;
  background: var(--portal-mint);
  box-shadow: 0 5px 0 var(--portal-blue);
  color: var(--portal-ink);
  cursor: pointer;
  font: 900 12px/1 system-ui, sans-serif;
  text-transform: uppercase;
}

html[data-portal-game-shell="true"] .portal-loading-actions button:last-child {
  background: transparent;
  color: #fff;
}

html[data-portal-game-shell="true"] .portal-loading-actions button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

html[data-portal-game-shell="true"] .portal-loading-announcement {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 620px) {
  html[data-portal-game-shell="true"] #boot-overlay {
    align-items: flex-end !important;
    background-position: 37% center !important;
  }

  html[data-portal-game-shell="true"] #boot-overlay .boot-background-video {
    object-position: 37% center;
  }

  html[data-portal-game-shell="true"] #boot-overlay .boot-center {
    width: calc(100vw - 24px) !important;
    margin-bottom: max(20px, env(safe-area-inset-bottom)) !important;
    padding: 24px 20px 22px !important;
    border-radius: 26px 6px 26px 6px !important;
  }

  html[data-portal-game-shell="true"] #boot-overlay .boot-center::before {
    width: min(62vw, 214px);
    height: 76px;
    margin-bottom: 0;
  }

  html[data-portal-game-shell="true"] #boot-overlay .boot-kicker {
    padding: 7px 16px;
    font-size: 8px !important;
    letter-spacing: .1em !important;
  }

  html[data-portal-game-shell="true"] #boot-title {
    margin-top: 15px !important;
    font-size: clamp(25px, 9vw, 34px) !important;
  }

  html[data-portal-game-shell="true"] .portal-loading-route__step {
    font-size: 9px;
    letter-spacing: 0;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  html[data-portal-game-shell="true"] #boot-overlay .boot-center {
    width: min(76vw, 620px) !important;
    padding: max(14px, env(safe-area-inset-top)) 30px max(16px, env(safe-area-inset-bottom)) !important;
  }

  html[data-portal-game-shell="true"] #boot-overlay .boot-center::before {
    width: 174px;
    height: 56px;
    margin-bottom: 2px;
  }

  html[data-portal-game-shell="true"] #boot-title {
    margin-top: 10px !important;
    font-size: 24px !important;
  }

  html[data-portal-game-shell="true"] #boot-progress {
    margin-top: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-portal-game-shell="true"] #boot-overlay .boot-background-video {
    display: none !important;
  }

  html[data-portal-game-shell="true"] #boot-progress.is-indeterminate #boot-progress-fill {
    width: 42% !important;
    transform: none !important;
    animation: none !important;
  }
}
