/* =========================================================
   SEU BAIRRO
   TELA PRINCIPAL + SIDEBAR RETRÁTIL
   ========================================================= */


/* =========================================================
   ESTRUTURA PRINCIPAL
   ========================================================= */

html,
body{
  width:100%;
  height:100%;
  margin:0;
  padding:0;

  overflow:hidden;
}


body{
  min-width:0;
}


.game{
  position:relative !important;

  width:100% !important;
  max-width:none !important;

  height:calc(100vh - 64px) !important;
  min-height:0 !important;

  margin:0 !important;
  padding:0 !important;

  display:block !important;

  overflow:hidden !important;
}


/* =========================================================
   ÁREA DO JOGO
   ========================================================= */

.stage{
  position:absolute !important;

  left:0 !important;
  top:0 !important;
  right:0 !important;
  bottom:0 !important;

  width:100% !important;
  height:100% !important;

  min-width:0 !important;
  min-height:0 !important;

  margin:0 !important;
  padding:0 !important;

  overflow:hidden !important;

  box-sizing:border-box !important;
}


/* =========================================================
   CANVAS
   ========================================================= */

#map{
  position:absolute;

  left:0;
  top:0;

  width:100%;
  height:100%;

  display:block;

  image-rendering:pixelated;
  image-rendering:crisp-edges;

  cursor:default;
}


/* =========================================================
   SIDEBAR
   ========================================================= */

.side{
  position:absolute !important;

  left:0;
  top:0;
  bottom:0;

  width:230px !important;
  min-width:230px !important;
  max-width:230px !important;

  height:100% !important;

  box-sizing:border-box;

  z-index:1000;

  overflow:hidden;

  transition:
    width .25s ease,
    min-width .25s ease,
    max-width .25s ease,
    box-shadow .25s ease;

  /*
    Fundo levemente translúcido.
    O mapa continua sendo a área principal.
  */

  background:
    linear-gradient(
      180deg,
      rgba(7,15,18,.97),
      rgba(8,18,21,.94)
    );

  border-right:
    1px solid rgba(255,209,102,.18);

  box-shadow:
    8px 0 28px rgba(0,0,0,.35);

  backdrop-filter:
    blur(8px);

  -webkit-backdrop-filter:
    blur(8px);
}


/* =========================================================
   SIDEBAR FECHADA
   ========================================================= */

.game.sidebar-collapsed .side{
  width:54px !important;
  min-width:54px !important;
  max-width:54px !important;

  box-shadow:
    5px 0 18px rgba(0,0,0,.30);
}


/* =========================================================
   CONTEÚDO DA SIDEBAR
   ========================================================= */

.sidebar-content{
  width:230px;
  min-width:230px;

  height:100%;

  box-sizing:border-box;

  padding:
    18px 12px 18px 12px;

  overflow-y:auto;
  overflow-x:hidden;

  scrollbar-width:thin;
}


.game.sidebar-collapsed
.sidebar-content{
  opacity:0;
  pointer-events:none;

  transform:translateX(-10px);

  transition:
    opacity .12s ease,
    transform .18s ease;
}


.game:not(.sidebar-collapsed)
.sidebar-content{
  opacity:1;

  transform:translateX(0);

  transition:
    opacity .18s ease .05s,
    transform .22s ease;
}


/* =========================================================
   BOTÃO DA SETA
   ========================================================= */

.sidebar-toggle{
  position:absolute !important;

  top:50%;
  right:-1px;

  width:26px;
  height:52px;

  transform:translateY(-50%);

  margin:0;
  padding:0;

  border:0;

  border-radius:
    9px 0 0 9px;

  background:
    rgba(10,22,25,.98);

  color:
    #ffe08a;

  font-size:17px;
  font-weight:bold;

  line-height:1;

  display:flex;
  align-items:center;
  justify-content:center;

  cursor:pointer;

  z-index:1100;

  box-shadow:
    -2px 0 8px rgba(0,0,0,.30);

  transition:
    background .18s ease,
    color .18s ease,
    width .18s ease;
}


.sidebar-toggle:hover{
  width:30px;

  background:
    rgba(18,38,42,1);

  color:
    #b7ff9f;
}


.sidebar-toggle:active{
  transform:
    translateY(-50%)
    scale(.96);
}


/* =========================================================
   QUANDO FECHADA
   ========================================================= */

.game.sidebar-collapsed
.sidebar-toggle{
  right:-1px;
}


/* =========================================================
   PROFILE CARD
   ========================================================= */

.profile-card{
  transition:
    opacity .15s ease,
    transform .2s ease;
}


.game.sidebar-collapsed
.profile-card{
  opacity:0;
  pointer-events:none;
}


/* =========================================================
   MENU
   ========================================================= */

.menu{
  display:flex;

  flex-direction:column;

  gap:8px;

  margin-top:14px;
}


.menu button{
  width:100%;

  min-height:42px;

  display:flex;
  align-items:center;

  gap:10px;

  box-sizing:border-box;

  white-space:nowrap;

  overflow:hidden;

  transition:
    background .15s ease,
    transform .15s ease;
}


.menu-icon{
  width:24px;
  min-width:24px;

  display:flex;

  align-items:center;
  justify-content:center;

  font-size:17px;
}


.menu-text{
  overflow:hidden;

  text-overflow:ellipsis;

  white-space:nowrap;
}


.game.sidebar-collapsed
.menu button{
  justify-content:center;

  padding-left:0 !important;
  padding-right:0 !important;
}


.game.sidebar-collapsed
.menu-text{
  display:none;
}


/* =========================================================
   AJUDA
   ========================================================= */

.sidebar-help{
  transition:
    opacity .15s ease;
}


.game.sidebar-collapsed
.sidebar-help{
  opacity:0;
}


/* =========================================================
   CHAVE DO MAPA
   ========================================================= */

.map-key{
  transition:
    opacity .15s ease;
}


.game.sidebar-collapsed
.map-key{
  opacity:0;
}


/* =========================================================
   CHAT INPUT
   ========================================================= */

.chat-input-bar{
  position:absolute;

  left:50%;
  bottom:22px;

  transform:
    translateX(-50%);

  z-index:2000;

  width:min(
    620px,
    calc(100% - 40px)
  );

  min-height:46px;

  box-sizing:border-box;

  display:flex;

  align-items:center;

  gap:10px;

  padding:
    8px 12px;

  border-radius:10px;

  background:
    rgba(6,14,17,.96);

  border:
    1px solid rgba(255,209,102,.35);

  box-shadow:
    0 8px 30px rgba(0,0,0,.45),
    0 0 16px rgba(255,209,102,.08);

  backdrop-filter:
    blur(8px);

  -webkit-backdrop-filter:
    blur(8px);
}


.chat-input-bar.hidden{
  display:none !important;
}


.chat-prefix{
  flex:0 0 auto;

  font-size:18px;
}


.chat-input-bar input{
  flex:1 1 auto;

  min-width:0;

  height:30px;

  border:0;
  outline:0;

  background:transparent;

  color:#fff;

  font-size:14px;
}


.chat-input-bar input::placeholder{
  color:rgba(255,255,255,.42);
}


.chat-help{
  flex:0 0 auto;

  font-size:10px;

  white-space:nowrap;

  opacity:.55;
}


/* =========================================================
   BALÃO DE FALA
   ========================================================= */

.bubble{
  position:absolute;

  z-index:1500;

  max-width:230px;

  box-sizing:border-box;

  padding:
    7px 10px;

  border-radius:9px;

  background:
    rgba(255,255,255,.97);

  border:
    2px solid #C9932B;

  color:#1d2430;

  font-family:
    'Press Start 2P',monospace;
  font-size:10px;
  line-height:1.6;

  white-space:normal;

  word-break:break-word;

  pointer-events:none;

  transform:
    translate(-50%,-100%);

  box-shadow:
    0 3px 0 rgba(0,0,0,.28),0 0 14px rgba(255,209,102,.55);

  animation:
    bubbleIn .12s ease-out;
}

.bubble .bname{
  font-weight:bold;
  color:#8a4b00;
}


.bubble::after{
  content:"";

  position:absolute;

  left:50%;
  bottom:-6px;

  width:8px;
  height:8px;

  transform:
    translateX(-50%)
    rotate(45deg);

  background:
    rgba(255,255,255,.97);

  border-right:
    2px solid #C9932B;

  border-bottom:
    2px solid #C9932B;
}


@keyframes bubbleIn{

  from{
    opacity:0;
    transform:
      translate(-50%,-92%);
  }

  to{
    opacity:1;
    transform:
      translate(-50%,-100%);
  }

}


/* =========================================================
   RESPONSIVO
   ========================================================= */

@media(
  max-width:800px
){

  .game{
    height:calc(100vh - 58px) !important;
  }


  .side{
    width:210px !important;
    min-width:210px !important;
    max-width:210px !important;
  }


  .sidebar-content{
    width:210px;
    min-width:210px;
  }


  .game.sidebar-collapsed
  .side{
    width:52px !important;
    min-width:52px !important;
    max-width:52px !important;
  }


  .chat-help{
    display:none;
  }


  .chat-input-bar{
    bottom:12px;

    width:
      calc(100% - 24px);
  }

}


/* =========================================================
   CELULAR
   ========================================================= */

@media(
  max-width:560px
){

  .side{
    width:205px !important;
    min-width:205px !important;
    max-width:205px !important;
  }


  .sidebar-content{
    width:205px;
    min-width:205px;
  }


  .game.sidebar-collapsed
  .side{
    width:50px !important;
    min-width:50px !important;
    max-width:50px !important;
  }


  .chat-input-bar{
    min-height:44px;

    padding:
      6px 9px;
  }


  .chat-input-bar input{
    font-size:13px;
  }

}


/* =========================================================
   GARANTIA CONTRA CSS ANTIGO
   ========================================================= */

.game{
  grid-template-columns:none !important;
}


.game .stage{
  flex:none !important;
}


.game .side{
  grid-column:auto !important;
}

/* =========================================================
   V24 — BAIRRO: CHAT SOMENTE COMO CAMPO INFERIOR
   ========================================================= */

#chatInputBar.chat-input-bar{
  position:absolute !important;
  left:50% !important;
  bottom:16px !important;
  transform:translateX(-50%) !important;
  z-index:2500 !important;
  width:min(620px,calc(100% - 32px)) !important;
  min-height:48px !important;
  display:flex !important;
  align-items:center !important;
  gap:9px !important;
  padding:7px 9px !important;
  box-sizing:border-box !important;
  border-radius:11px !important;
  background:rgba(4,10,13,.96) !important;
  border:1px solid rgba(255,209,102,.42) !important;
  box-shadow:0 10px 32px rgba(0,0,0,.48),0 0 18px rgba(255,209,102,.08) !important;
  backdrop-filter:blur(8px) !important;
  -webkit-backdrop-filter:blur(8px) !important;
}

#chatInputBar.chat-input-bar.hidden{
  display:none !important;
}

#chatInputBar .chat-prefix{
  flex:0 0 auto !important;
  font-size:18px !important;
}

#chatInputBar #chatInput{
  flex:1 1 auto !important;
  min-width:0 !important;
  height:32px !important;
  padding:4px 2px !important;
  border:0 !important;
  outline:0 !important;
  background:transparent !important;
  box-shadow:none !important;
  color:#fff !important;
  font-size:14px !important;
}

#chatInputBar #chatInput:focus{
  border:0 !important;
  box-shadow:none !important;
}

#chatInputBar .chat-help{
  flex:0 0 auto !important;
  color:rgba(255,255,255,.45) !important;
  font-size:9px !important;
  white-space:nowrap !important;
}

#chatInputBar #send{
  flex:0 0 auto !important;
  min-width:70px !important;
  min-height:34px !important;
  padding:7px 10px !important;
}

/* Não deixar nenhum painel de chat ocupar o lado direito do mapa. */
.game > .chatbox,
.game > .chat-dock,
#chatDock{
  display:none !important;
}

/* O palco ocupa 100% da tela; a lateral é apenas uma camada sobre ele. */
.game{
  display:block !important;
  position:relative !important;
  width:100% !important;
  max-width:none !important;
  overflow:hidden !important;
}

.game > .stage{
  position:absolute !important;
  inset:0 !important;
  width:100% !important;
  height:100% !important;
}

/* Balões ficam sobre o personagem e nunca bloqueiam o clique. */
.stage .bubble{
  z-index:2400 !important;
  pointer-events:none !important;
}

/* Mantém o botão retrátil da lateral acima do mapa. */
#sideToggle{
  z-index:3000 !important;
}

@media(max-width:700px){
  #chatInputBar.chat-input-bar{
    bottom:10px !important;
    width:calc(100% - 20px) !important;
  }
  #chatInputBar .chat-help{
    display:none !important;
  }
}

/* Rótulo "falar" acima do botão do microfone (VoIP por proximidade). */
#bottomUI #chatInputBar #micBtn{position:relative}
#bottomUI #chatInputBar #micBtn::before{
  content:'falar';
  position:absolute;
  bottom:calc(100% + 3px);
  left:50%;
  transform:translateX(-50%);
  font-size:9px;
  font-weight:800;
  letter-spacing:.08em;
  color:#FFD166;
  line-height:1;
  white-space:nowrap;
  pointer-events:none;
}
