*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #050814;
  font-family: "Rajdhani", system-ui, sans-serif;
  color: #f6f8ff;
}

#game-container {
  width: 100%;
  height: 100%;
  position: fixed;
  inset: 0;
}

#game-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hidden { display: none !important; }

/* ========== All UI uses absolute inside #ui-root (1920x1080) ========== */

.back-to-login {
  position: absolute;
  top: 32px;
  left: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #9ba9c9;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: .04em;
  transition: color .2s;
  z-index: 110;
}

.back-to-login svg {
  width: 20px;
  height: 20px;
}

.back-to-login-img {
  display: block;
  width: 288px;
  height: auto;
  transition: opacity .2s;
}

.back-to-login:hover {
  color: #55d8ff;
}

.back-to-login:hover .back-to-login-img {
  opacity: 0.8;
}

/* Loading */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: #050814;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(0, 183, 255, .2);
  border-top-color: #00b7ff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.loading-text {
  margin-top: 16px;
  color: #9ba9c9;
  font-size: 16px;
  letter-spacing: .1em;
}

.loading-logo {
  width: 360px;
  height: auto;
  margin-bottom: 44px;
  filter: drop-shadow(0 0 24px rgba(0, 183, 255, .35));
}

.loading-bar {
  width: 440px;
  height: 14px;
  background: rgba(0, 183, 255, .1);
  border: 1px solid rgba(0, 183, 255, .35);
  border-radius: 999px;
  overflow: hidden;
}

.loading-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #00b7ff, #66e0ff);
  border-radius: 999px;
  transition: width .25s ease;
}

.loading-meta {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-top: 22px;
}

.loading-meta .loading-text {
  margin-top: 0;
}

.loading-pct {
  color: #00b7ff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .06em;
  min-width: 52px;
  text-align: right;
}

.loading-step {
  margin-top: 10px;
  min-height: 18px;
  color: #5f6d8f;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Na página do mundo a UI não bloqueia o canvas (clique trava o mouse) */
.world-ui {
  pointer-events: none;
}

/* Character Select */
.char-select {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  z-index: 100;
  pointer-events: none;
}

.char-select > * {
  pointer-events: auto;
}

.char-select-header {
  position: absolute;
  top: 43px;
  left: 960px;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
}

.char-select-title {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: .04em;
  text-shadow: 0 0 24px rgba(0, 183, 255, .5);
  margin-bottom: 8px;
}

.char-select-title-img {
  display: block;
  width: 546px;
  height: auto;
}

.char-select-sub {
  color: #9ba9c9;
  font-size: 18px;
  letter-spacing: .08em;
}

.char-slots {
  position: absolute;
  bottom: 100px;
  left: 960px;
  transform: translateX(-50%);
  display: flex;
  gap: 60px;
  align-items: flex-end;
}

.char-slot {
  width: 360px;
  height: 440px;
  border: none;
  border-radius: 16px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .2s, filter .2s;
  overflow: visible;
  flex-shrink: 0;
  position: relative;
}

.char-slot:hover {
  filter: brightness(1.1);
}

.char-slot.disabled {
  pointer-events: none;
  filter: grayscale(1) brightness(0.4);
  opacity: .5;
}

.char-slot-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #5a6a8a;
}

.char-slot-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 14px;
}

.char-slot-empty svg {
  width: 40px;
  height: 40px;
  opacity: .5;
}

.char-slot-empty span {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .06em;
}

.char-slot.filled {
  background: transparent;
  cursor: pointer;
}

.char-slot.filled:hover {
  filter: brightness(1.2) drop-shadow(0 0 16px rgba(255, 146, 22, .4));
}

.char-slot-filled {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  position: relative;
}

.char-slot-name {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #f6f8ff;
  text-shadow: 0 0 12px rgba(0, 183, 255, .5);
  text-align: center;
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  z-index: 2;
}

.char-slot-canvas {
  display: block;
  width: 360px;
  height: 440px;
}

.char-slot-play {
  margin-top: 8px;
  border: 0;
  color: white;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 3px;
  padding: 12px 48px;
  cursor: pointer;
  background: linear-gradient(100deg, #00a9ff 0%, #246ee9 46%, #e5223e 100%);
  box-shadow: 0 6px 24px rgba(0, 112, 255, .3);
  clip-path: polygon(0 0, 96% 0, 100% 24%, 100% 100%, 4% 100%, 0 76%);
  transition: .2s;
  z-index: 5;
}

.char-slot-play:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 150, 255, .5);
}

.char-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00b7ff, #ff2e32);
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, .4);
}

.char-level {
  font-size: 13px;
  color: #9ba9c9;
  letter-spacing: .06em;
}

/* ========== Teleport popup (imagem 1920x1080) ========== */
.teleport-popup {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  z-index: 150;
  background: #010211;
  box-shadow: 0 0 0 3000px #010211;
  pointer-events: auto;
}

.teleport-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  user-select: none;
  -webkit-user-drag: none;
}

.tp-hotspot {
  position: absolute;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
}

.tp-hotspot:hover {
  background: rgba(255, 255, 255, .1);
}

.tp-hotspot.tp-locked {
  background: rgba(0, 0, 0, .55);
  cursor: default;
  pointer-events: none;
}

.tp-cidade {
  left: 1265px;
  top: 48px;
  width: 432px;
  height: 136px;
}

.tp-cancel {
  left: 1717px;
  top: 49px;
  width: 170px;
  height: 142px;
}

.tp-agua {
  left: 668px;
  top: 207px;
  width: 286px;
  height: 298px;
}

.tp-normal {
  left: 47px;
  top: 207px;
  width: 286px;
  height: 298px;
}

.tp-fogo {
  left: 361px;
  top: 207px;
  width: 286px;
  height: 298px;
}

.tp-eletrico {
  left: 975px;
  top: 207px;
  width: 286px;
  height: 298px;
}

.tp-grama {
  left: 1282px;
  top: 207px;
  width: 286px;
  height: 298px;
}

.tp-gelo {
  left: 1594px;
  top: 207px;
  width: 286px;
  height: 298px;
}

.tp-lutador {
  left: 47px;
  top: 508px;
  width: 286px;
  height: 275px;
}

.tp-veneno {
  left: 361px;
  top: 508px;
  width: 286px;
  height: 275px;
}

.tp-terra {
  left: 668px;
  top: 508px;
  width: 286px;
  height: 275px;
}

.tp-voador {
  left: 975px;
  top: 508px;
  width: 286px;
  height: 275px;
}

.tp-psiquico {
  left: 1282px;
  top: 508px;
  width: 286px;
  height: 275px;
}

.tp-inseto {
  left: 1594px;
  top: 508px;
  width: 286px;
  height: 275px;
}

.tp-pedra {
  left: 47px;
  top: 785px;
  width: 286px;
  height: 257px;
}

.tp-fantasma {
  left: 361px;
  top: 785px;
  width: 286px;
  height: 257px;
}

.tp-dragon {
  left: 668px;
  top: 785px;
  width: 286px;
  height: 257px;
}

.tp-sombrio {
  left: 975px;
  top: 785px;
  width: 286px;
  height: 257px;
}

.tp-aco {
  left: 1282px;
  top: 785px;
  width: 286px;
  height: 257px;
}

.tp-fada {
  left: 1594px;
  top: 785px;
  width: 286px;
  height: 257px;
}
