/* ====================================================
   HUD META — exibido durante o jogo
   ==================================================== */

@font-face {
  font-family: 'LilitaOne';
  src: url('../assets/font/lilita-one.woff2') format('woff2'),
       url('../assets/font/lilita-one.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

/* Wrapper — canto direito, colado abaixo do placar nativo */
#hud-meta {
  position: fixed;
  top: clamp(72px, 9.5vh, 104px);
  right: clamp(2px, 1vw, 8px);
  left: auto;
  transform: none;
  z-index: 2147483647;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  width: clamp(180px, 38vw, 240px);
  transition: top 0.3s ease;
}

/* Ao bater a meta, desce os contadores para não sobrepor o botão */
body:has(#sair.cashout-visible) #hud-meta {
  top: clamp(128px, 16vh, 168px);
}

/* Barra igual ao contador nativo (base-long.png) */
#hud-meta .hm-row {
  --bar-h: clamp(52px, 11vw, 80px);
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
  width: fit-content;
  max-width: 100%;
  align-self: flex-end;
  height: var(--bar-h);
  padding: 0 clamp(0.45em, 2.5vw, 0.7em);
  font-size: clamp(22px, 5.5vw, 30px);
  box-sizing: border-box;
  background: transparent;
  border: none;
  border-radius: calc(var(--bar-h) * 0.2);
  overflow: hidden;
}

#hud-meta .hm-row::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('../assets/ui/base-long.png') no-repeat center;
  background-size: 100% 100%;
  opacity: 0.32;
  z-index: -1;
  pointer-events: none;
}

/* Texto R$ 00,00 — estilo placar nativo */
#hud-meta .hm-val {
  font-family: 'LilitaOne', Impact, 'Arial Black', sans-serif;
  font-size: 1em;
  color: #ffffff;
  white-space: nowrap;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.85), 0 2px 3px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.02em;
  text-align: center;
}

/* Moeda — altura igual ao texto */
#hud-meta .hm-coin {
  width: 2em;
  height: 2em;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  background: transparent;
  mix-blend-mode: lighten;
  align-self: center;
}

/* Label META entre os dois contadores */
#hud-meta .hm-label {
  font-family: 'LilitaOne', Impact, 'Arial Black', sans-serif;
  font-size: clamp(16px, 4.2vw, 22px);
  color: #55ff22;
  letter-spacing: 5px;
  line-height: 1;
  text-shadow: 0 0 10px rgba(80, 255, 50, 0.9);
  text-align: center;
  text-transform: uppercase;
  width: 100%;
}

/* Barra de progresso */
#hud-meta .hm-bar-track {
  width: 100%;
  height: clamp(12px, 3vw, 16px);
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

#hud-meta .hm-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3de020, #7fff3a);
  transition: width 0.4s ease;
}

/* Botão ENCERRAR APOSTA — visível ao bater a meta */
button#sair {
  display: none;
  position: fixed;
  top: clamp(58px, 8vh, 74px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2147483647;
  padding: 14px 38px;
  font-family: 'LilitaOne', 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(15px, 3.8vw, 18px);
  font-weight: normal;
  letter-spacing: 0.05em;
  line-height: 1.2;
  color: #ffffff;
  text-transform: uppercase;
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 50%, #16a34a 100%);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 14px;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.35),
    0 3px 0 #15803d,
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  cursor: pointer;
  pointer-events: auto;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  -webkit-font-smoothing: antialiased;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button#sair:hover {
  transform: translateX(-50%) translateY(-1px);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.4),
    0 3px 0 #15803d,
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

button#sair:active {
  transform: translateX(-50%) translateY(2px);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.3),
    0 1px 0 #15803d,
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

button#sair.cashout-visible {
  display: block;
  animation: cashoutPopTop 0.35s ease-out;
}

@keyframes cashoutPopTop {
  from { opacity: 0; transform: translateX(-50%) scale(0.9); }
  to   { opacity: 1; transform: translateX(-50%) scale(1); }
}

#sair.cashout-visible,
button#sair.cashout-visible {
  pointer-events: auto;
}

@media (max-width: 480px) {
  #hud-meta {
    top: clamp(66px, 8.5vh, 96px);
    right: 2px;
    width: clamp(165px, 40vw, 220px);
  }
  #hud-meta .hm-row {
    padding: 0 clamp(0.4em, 2.5vw, 0.65em);
  }
  button#sair {
    top: clamp(52px, 7.2vh, 66px);
    padding: 12px 28px;
    font-size: clamp(14px, 3.6vw, 16px);
  }
  body:has(#sair.cashout-visible) #hud-meta {
    top: clamp(118px, 15vh, 155px);
  }
  #subway-cashout-wrap { display: none; }
}

@media (max-height: 480px) {
  #hud-meta {
    top: clamp(58px, 8vh, 88px);
    width: clamp(155px, 38vw, 210px);
  }
  body:has(#sair.cashout-visible) #hud-meta {
    top: clamp(108px, 14vh, 138px);
  }
}
