/* A árvore da lagoa (treeui.js): usa o vidro do .skill-panel e o mesmo cabeçalho do painel de habilidades */

body.playing.tree-open #treePanel {
  display: flex;
  flex-direction: column;
  animation: toastIn 0.3s both;
}

#treePanel {
  width: min(460px, calc(100vw - 24px));
  max-height: calc(100vh - 150px);
  max-height: calc(100dvh - 150px);
  padding: 10px;
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(30, 44, 58, .98), rgba(15, 22, 34, .98));
  border-color: rgba(120, 230, 170, .38);
  box-shadow: 0 4px 0 rgba(6, 12, 20, .72), 0 18px 40px rgba(6, 14, 22, .45), inset 0 1px rgba(255, 255, 255, .08);
}

#treePanel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(90deg, #ff7a2e, #8be04a, #3fd3a0, #ffd23f, #63d3ff, #c9a6ff);
}

body.playing.tree-open #feed {
  opacity: 0;
}

#treePanel .sp-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.tr-sum {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 2px 6px;
  font-weight: 800;
  font-size: 15px;
}

.tr-sum b {
  color: #7dffb5;
  font-family: var(--display);
  font-size: 20px;
}

.tr-sum small {
  color: var(--lilac);
  font-weight: 700;
  font-size: 11px;
}

.tr-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  margin: 0 2px 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--lilac);
}

.tr-legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 50%;
  background: #888;
}

.tr-legend .dot.dia {
  border-radius: 2px;
  transform: rotate(45deg);
  background: #f4e9ff;
}

.tr-map {
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 12px;
  background: radial-gradient(circle at 50% 50%, rgba(60, 90, 80, .35), rgba(8, 12, 22, .7) 70%);
}

.tr-map svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 52vh;
  touch-action: manipulation;
}

.tr-map .ring {
  fill: none;
  stroke: rgba(255, 255, 255, .05);
  stroke-width: 1;
}

.tr-map .link {
  stroke: rgba(255, 255, 255, .16);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.tr-map .link.hub {
  stroke-dasharray: 2 5;
  stroke: rgba(255, 255, 255, .1);
}

.tr-map .link.on {
  stroke-width: 4;
}

.tr-map .hub-c {
  fill: rgba(20, 30, 40, .9);
  stroke: rgba(255, 255, 255, .25);
  stroke-width: 1.5;
}

.tr-map .hub-t {
  font-size: 22px;
  text-anchor: middle;
  dominant-baseline: central;
}

.tr-map .node {
  cursor: pointer;
  outline: none;
}

.tr-map .node .shape {
  stroke-width: 2.4;
  fill: #1a1030;
  opacity: .5;
  transition: opacity .15s, filter .15s;
}

.tr-map .node .ico {
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  opacity: .55;
}

.tr-map .node.can .shape {
  opacity: 1;
  animation: trPulse 1.1s infinite alternate;
}

.tr-map .node.can .ico,
.tr-map .node.on .ico {
  opacity: 1;
}

.tr-map .node.on .shape {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, .55));
}

.tr-map .node.k-k .shape {
  stroke-width: 3.4;
}

.tr-map .node.sel .shape,
.tr-map .node:focus-visible .shape {
  stroke: #fff;
  opacity: 1;
  stroke-width: 3.6;
}

@keyframes trPulse {
  to {
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, .7));
  }
}

@media (prefers-reduced-motion: reduce) {
  .tr-map .node.can .shape {
    animation: none;
  }
}

.tr-card {
  margin: 8px 0 4px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 10px;
  background: rgba(255, 255, 255, .05);
  min-height: 74px;
}

.tr-card.empty {
  display: flex;
  align-items: center;
  color: var(--lilac);
  font-size: 12px;
  font-weight: 700;
}

.tr-card.k-k {
  border-color: rgba(255, 217, 120, .5);
}

.tr-card.k-b {
  border-color: rgba(244, 233, 255, .5);
}

.tc-top {
  display: flex;
  align-items: center;
  gap: 9px;
}

.tc-ico {
  font-size: 26px;
  line-height: 1;
}

.tc-name {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: 16px;
  line-height: 1.1;
}

.tc-kind {
  color: var(--lilac);
  font-weight: 700;
  font-size: 10.5px;
}

.tc-desc {
  margin: 5px 0 7px;
  font-weight: 700;
  font-size: 12.5px;
  line-height: 1.3;
}

.tc-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tc-btns small {
  color: var(--lilac);
  font-size: 10.5px;
  font-weight: 700;
}

.tc-b,
.tr-tools button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 9px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-weight: 800;
  font-size: 12.5px;
}

.tc-b.go {
  border: 0;
  background: linear-gradient(180deg, #6ee06a, #37b24a);
  box-shadow: 0 3px 0 var(--green-dark);
}

.tc-b:disabled,
.tr-tools button:disabled {
  opacity: .45;
}

.tr-tools {
  display: flex;
  justify-content: flex-end;
  margin: 2px 0 4px;
}

.tr-note {
  margin: 0 2px 6px;
  color: var(--lilac);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.tr-relics {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 4px;
}

.rel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 10px;
  background: rgba(255, 255, 255, .04);
  color: #fff;
  text-align: left;
}

.rel:disabled {
  opacity: .5;
}

.rel.own {
  border-color: rgba(255, 217, 120, .45);
  background: linear-gradient(100deg, rgba(255, 217, 120, .14), rgba(255, 255, 255, .04));
}

.rel.active {
  border-color: #7dffb5;
  box-shadow: 0 0 0 2px rgba(125, 255, 181, .35);
}

.rel-ico {
  flex: none;
  font-size: 28px;
  line-height: 1;
}

.rel div {
  flex: 1;
  min-width: 0;
}

.rel b {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: 14px;
}

.rel small {
  display: block;
  color: var(--lilac);
  font-weight: 700;
  font-size: 10.5px;
  line-height: 1.25;
}

.rel em {
  flex: none;
  font-style: normal;
  font-weight: 800;
  font-size: 11px;
  color: #7dffb5;
}

/* o botão da árvore mora entre a ficha e a bolsa */
.tree-btn {
  font-size: 19px;
}

@media (max-width: 520px) {
  #treePanel {
    left: 8px;
    width: calc(100vw - 16px);
  }
}

/* tela larga: o mapa de um lado, o texto do nó e as relíquias do outro */
@media (min-width: 760px) {
  #treePanel {
    width: min(860px, calc(100vw - 32px));
  }
  .tr-cols {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }
  .tr-map svg {
    max-height: calc(100vh - 290px);
    max-height: calc(100dvh - 290px);
    min-height: 260px;
  }
  .tr-card {
    margin-top: 0;
  }
}

/* ---------------------------------------------------------------------------------------------------------------------
   (o resto deste arquivo é da ARENA PvP e dos DEBUFFS do chefão da temporada: arenaview.js e debuffs.js) */

/* painel do PvP: só aparece pra quem está dentro do anel */
.arena-hud {
  position: fixed;
  left: 50%;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 92px);
  transform: translateX(-50%);
  z-index: 6;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  max-width: min(440px, calc(100vw - 24px));
  padding: 8px 14px;
  border: 1px solid rgba(255, 200, 74, 0.55);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(58, 30, 10, 0.86), rgba(28, 14, 6, 0.86));
  box-shadow: 0 4px 0 rgba(20, 8, 2, 0.6), 0 12px 28px rgba(0, 0, 0, 0.35);
  color: #fff3c4;
  text-align: center;
  pointer-events: none;
}

body.playing.arena-on .arena-hud {
  display: flex;
}

.arena-hud .ah-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--display);
  font-size: 18px;
}

.arena-hud .ah-top span {
  color: #7dffb5;
  font-weight: 800;
  font-size: 15px;
}

.arena-hud .ah-king {
  font-weight: 800;
  font-size: 13px;
  color: #ffd45a;
}

.arena-hud small {
  font-weight: 700;
  font-size: 10.5px;
  opacity: 0.85;
}

/* na arena o rio e as habilidades automáticas ficam de lado */
body.arena-on #autoBtn {
  opacity: 0.3;
}

body.arena-on .phase {
  opacity: 0.4;
}

body.bag-open .arena-hud,
body.tree-open .arena-hud,
body.offline .arena-hud {
  display: none !important;
}

/* ---- debuffs do chefão da temporada */

/* escuridão: a tela escurece, sobra só um círculo de luz em volta do pepe */
.dark-fx {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s ease-out;
  background: radial-gradient(circle at 50% 55%, rgba(4, 2, 12, 0) 0, rgba(4, 2, 12, 0.35) 9%, rgba(4, 2, 12, 0.94) 26%, rgba(2, 1, 6, 0.98) 100%);
}

.dark-fx.on {
  opacity: 1;
}

/* veneno: névoa verde nas bordas */
.poison-fx {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease-out;
  box-shadow: inset 0 0 110px 22px rgba(94, 255, 60, 0.3);
  background: radial-gradient(circle at 50% 50%, rgba(80, 200, 60, 0) 60%, rgba(80, 200, 60, 0.1) 100%);
}

.poison-fx.on {
  opacity: 1;
  animation: poisonPulse 1.1s ease-in-out infinite alternate;
}

@keyframes poisonPulse {
  to {
    box-shadow: inset 0 0 150px 40px rgba(94, 255, 60, 0.38);
  }
}

@media (prefers-reduced-motion: reduce) {
  .poison-fx.on {
    animation: none;
  }
}

/* os avisos de debuff (tempo que falta) */
.debuffs {
  position: fixed;
  left: 50%;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 150px);
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

.debuffs .deb {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 6px;
  min-width: 132px;
  padding: 5px 10px 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(20, 12, 34, 0.86);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}

.debuffs .deb[hidden] {
  display: none;
}

.debuffs .deb .ic {
  font-size: 18px;
}

.debuffs .deb em {
  font-style: normal;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}

.debuffs .deb i {
  grid-column: 1 / -1;
  height: 4px;
  margin-top: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.debuffs .deb u {
  display: block;
  height: 100%;
  background: #fff;
}

.deb-dark {
  border-color: #9b6bff;
}
.deb-dark u {
  background: #9b6bff;
}
.deb-venom {
  border-color: #7dff3a;
}
.deb-venom u {
  background: #7dff3a;
}
.deb-seal {
  border-color: #5fd8ff;
}
.deb-seal u {
  background: #5fd8ff;
}

/* calado: os botões de golpe ficam apagados */
body.silenced #croakBtn,
body.silenced #lickBtn,
body.silenced #ultBtn {
  opacity: 0.3;
  filter: grayscale(1);
}

body.bag-open .debuffs {
  display: none;
}

/* celular: os botões de ação ficam embaixo à direita, então o painel da arena e os avisos de debuff sobem */
body.touch .arena-hud {
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 168px);
}

body.touch .debuffs {
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 262px);
}
