:root {
  --cyan:#22e6ff; --mag:#ff3df0; --gold:#ffd23f; --green:#2fe08a;
  --bg0:#05040e; --panel:rgba(18,12,46,.92); --line:#2a2160; --txt:#eafcff; --muted:#9fb0e0;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; }
html, body { height: 100%; overflow: hidden; background: var(--bg0); color: var(--txt);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; touch-action: none; }
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#score { position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  font-size: 30px; font-weight: 900; color: var(--gold); text-shadow: 0 0 14px rgba(255,210,63,.6); letter-spacing: 1px; }
#board { position: absolute; top: 12px; right: 12px; background: rgba(10,8,26,.6); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 12px; min-width: 150px; backdrop-filter: blur(4px); }
.board-title { font-size: 10px; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 4px; }
#lb { list-style: none; padding: 0; margin: 0; font-size: 12.5px; }
#lb li { display: flex; justify-content: space-between; gap: 10px; padding: 1px 0; }
#lb li.me { color: var(--cyan); font-weight: 800; }
#lb li b { color: var(--gold); font-weight: 700; }
#count { font-size: 10px; color: var(--muted); margin-top: 5px; border-top: 1px solid var(--line); padding-top: 4px; }
#minimap { position: absolute; bottom: 12px; right: 12px; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(10,8,26,.5); }
#boostHint { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); }

/* ---- Telas (menu / morte) ---- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 90% at 50% 0%, rgba(40,20,90,.6), rgba(5,4,14,.9)); z-index: 10; padding: 20px; }
.panel { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 26px 22px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.panel h1 { font-size: 26px; font-weight: 900; letter-spacing: .5px;
  background: linear-gradient(90deg, var(--cyan), var(--mag)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.panel h2 { font-size: 20px; color: var(--mag); letter-spacing: 1px; }
.sub { color: var(--muted); font-size: 13px; margin: 8px 0 18px; }
#nick { width: 100%; background: #0b0922; border: 1px solid var(--line); color: var(--txt); border-radius: 12px;
  padding: 13px 14px; font-size: 16px; text-align: center; font-weight: 700; }
#colors { display: flex; gap: 8px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 3px solid transparent;
  box-shadow: 0 0 10px rgba(255,255,255,.2); transition: transform .1s; }
.swatch.sel { border-color: #fff; transform: scale(1.15); }
button { width: 100%; border: 0; border-radius: 14px; padding: 15px; font-size: 17px; font-weight: 900; letter-spacing: .5px;
  cursor: pointer; color: #04121f; background: linear-gradient(180deg, var(--cyan), #0f9fd0);
  box-shadow: 0 8px 20px rgba(34,230,255,.35); transition: transform .06s, filter .15s; }
button:active { transform: translateY(2px) scale(.99); }
button:hover { filter: brightness(1.08); }
.hint { font-size: 11px; color: var(--muted); margin-top: 14px; line-height: 1.4; }
.conn { font-size: 12px; color: var(--gold); margin-top: 10px; min-height: 16px; }
.bigscore { margin: 16px 0 20px; font-size: 54px; font-weight: 900; color: var(--gold); text-shadow: 0 0 18px rgba(255,210,63,.5); line-height: 1; }
.bigscore small { display: block; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: 2px; margin-top: 4px; }
#againBtn { background: linear-gradient(180deg, var(--green), #13a866); color: #04210f; box-shadow: 0 8px 20px rgba(47,224,138,.35); }

/* ===== HUD PvP ===== */
#statbar { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); display: flex; gap: 16px;
  font-size: 13px; color: var(--muted); background: rgba(10,8,26,.55); border: 1px solid var(--line); padding: 5px 14px; border-radius: 999px; }
#statbar b { color: var(--txt); }
#killfeed { position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 5px; pointer-events: none; max-width: 48vw; }
.kf { font-size: 12.5px; background: rgba(10,8,26,.6); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px;
  animation: kfIn .2s ease, kfOut .5s ease 3.4s forwards; }
.kf b { color: #fff; } .kf.mine { border-color: var(--cyan); box-shadow: 0 0 12px rgba(34,230,255,.3); }
@keyframes kfIn { from { transform: translateX(-16px); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes kfOut { to { opacity: 0; transform: translateX(-10px) } }
#toast { position: absolute; top: 26%; left: 50%; transform: translateX(-50%); font-size: 26px; font-weight: 900;
  color: var(--win, #2fe08a); text-shadow: 0 0 18px rgba(47,224,138,.6); opacity: 0; pointer-events: none; }
#toast.show { animation: toastPop 1.6s ease forwards; }
@keyframes toastPop { 0% { opacity: 0; transform: translateX(-50%) scale(.7) } 15% { opacity: 1; transform: translateX(-50%) scale(1.05) } 80% { opacity: 1 } 100% { opacity: 0 } }
.d-killer { color: var(--lose, #ff5a7a); font-weight: 700; margin: 4px 0 2px; min-height: 18px; }
.summary { display: flex; justify-content: center; gap: 22px; margin: 6px 0 18px; }
.summary > div { display: flex; flex-direction: column; }
.summary .l { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.summary b { font-size: 20px; color: var(--cyan); }
@media (prefers-reduced-motion: reduce){ .kf, #toast.show { animation-duration: .01s } }

/* ===== Carteira / entrada (dinheiro) ===== */
#topbar { position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 6; display: flex; align-items: center;
  justify-content: space-between; padding: 0 14px; pointer-events: none; }
#topbar a { pointer-events: auto; }
#hdrlogo { height: 30px; width: auto; display: block; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
#hdrWallet { pointer-events: auto; background: rgba(10,8,26,.6); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; font-size: 13px; color: var(--muted); }
#hdrWallet b { color: var(--gold); font-size: 15px; }
.demo { font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; margin-left: 2px; }
#scoreLabel { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); font-size: 10px; letter-spacing: 1px;
  color: var(--muted); text-transform: uppercase; }
#score { color: var(--gold); }
#toast small { display: block; font-size: 13px; font-weight: 700; color: #eafff4; margin-top: 2px; }

.panel-logo { max-width: 240px; width: 70%; height: auto; display: block; margin: 0 auto 6px; }
.tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.tier { padding: 13px 4px; border-radius: 12px; border: 1px solid var(--line); background: #0d1230; color: var(--txt);
  font-weight: 800; font-size: 15px; cursor: pointer; }
.tier.sel { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 14px rgba(255,210,63,.3); background: #15132e; }
.custom { text-align: left; margin: 6px 0; }
.custom label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 4px; }
.custom input { width: 100%; background: #0b0922; border: 1px solid var(--line); color: var(--txt); border-radius: 10px; padding: 10px 12px; font-size: 15px; }
.entry-info { display: flex; justify-content: space-between; gap: 10px; margin: 10px 0; }
.entry-info > div { flex: 1; background: #0d1230; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; text-align: left; }
.entry-info span { font-size: 10px; color: var(--muted); text-transform: uppercase; display: block; }
.entry-info b { font-size: 16px; }
.rules { font-size: 11px; color: var(--muted); line-height: 1.4; margin: 6px 0 10px; }
.colors-row { display: flex; align-items: center; gap: 8px; justify-content: center; margin-bottom: 10px; }
.colors-label { font-size: 11px; color: var(--muted); }
.bigmoney { margin: 8px 0 14px; font-size: 48px; font-weight: 900; color: var(--gold); text-shadow: 0 0 18px rgba(255,210,63,.5); line-height: 1; }
.bigmoney small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 2px; margin-top: 4px; }
.d-balance { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.d-balance b { color: var(--gold); }

/* popup de entrada AO VIVO (sobre a arena) */
.overlaybar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; display: flex; justify-content: center; padding: 14px; pointer-events: none; }
.overlaybar.hidden { display: none; }
.ob-inner { pointer-events: auto; width: 100%; max-width: 440px; background: rgba(10,8,26,.82); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px 16px; backdrop-filter: blur(6px); box-shadow: 0 -4px 30px rgba(0,0,0,.5); text-align: center; }
.ob-bal { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.ob-bal b { color: var(--gold); font-size: 16px; }
.ob-rules { font-size: 10.5px; color: var(--muted); margin-top: 6px; line-height: 1.35; }
.pick-label { font-size: 12px; color: var(--muted); margin: 6px 0; }

/* ===== HUD compacto (carteira/ganhos/eliminações/nível/entrada) ===== */
#hudbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; align-items: stretch;
  background: rgba(10,8,26,.66); border: 1px solid var(--line); border-radius: 14px; padding: 6px 4px; backdrop-filter: blur(6px);
  pointer-events: none; max-width: 96vw; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.hw { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 58px; padding: 1px 9px;
  border-right: 1px solid rgba(255,255,255,.07); }
.hw:last-child { border-right: 0; }
.hw span { font-size: 8.5px; letter-spacing: .4px; color: var(--muted); text-transform: uppercase; white-space: nowrap; }
.hw b { font-size: 15px; font-weight: 800; color: var(--txt); line-height: 1.25; }
.hw.prov b { color: var(--gold); text-shadow: 0 0 10px rgba(255,210,63,.5); }

/* ===== Botão COLETAR — premium estilo cassino (pílula dourada, compacto) ===== */
#collectBtn { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); width: auto; pointer-events: auto;
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px; border-radius: 999px;
  border: 1px solid rgba(255,214,90,.7); color: #3a2600; font-weight: 900; font-size: 14px; letter-spacing: .4px;
  background: linear-gradient(180deg, #ffe88a 0%, #f7bd18 55%, #d99400 100%);
  box-shadow: 0 6px 22px rgba(245,179,1,.45), inset 0 1px 0 rgba(255,255,255,.6); cursor: pointer;
  transition: transform .08s, filter .15s, opacity .2s; }
#collectBtn b { font-size: 15px; }
#collectBtn:hover { filter: brightness(1.07); }
#collectBtn:active { transform: translateX(-50%) translateY(2px) scale(.98); }
#collectBtn:disabled { opacity: .35; filter: grayscale(.6); cursor: default; box-shadow: none; }
#collectBtn.pulsing { animation: collectPulse .85s ease-in-out infinite; }
@keyframes collectPulse { 0%,100% { box-shadow: 0 6px 22px rgba(245,179,1,.45), inset 0 1px 0 rgba(255,255,255,.6) }
  50% { box-shadow: 0 6px 32px rgba(245,179,1,.9), inset 0 1px 0 rgba(255,255,255,.6) } }

/* indicador de PERIGO crescente (borda vermelha pulsante por nível) */
#dangerFx { position: fixed; inset: 0; pointer-events: none; z-index: 5;
  box-shadow: inset 0 0 130px rgba(255,40,60,var(--dangerA,.2)); animation: dangerPulse 1.7s ease-in-out infinite; }
#dangerFx.hidden { display: none; }
@keyframes dangerPulse { 0%,100% { opacity: .65 } 50% { opacity: 1 } }

/* ===== Entrada FIXA R$5 — botão premium dourado (único) ===== */
.tiers { display: block; margin: 10px 0; }
.tier { display: block; width: 100%; padding: 15px; border-radius: 14px; border: 1px solid rgba(255,214,90,.6);
  background: linear-gradient(180deg, #ffe88a 0%, #f7bd18 55%, #d99400 100%); color: #3a2600;
  font-weight: 900; font-size: 18px; letter-spacing: .3px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(245,179,1,.4), inset 0 1px 0 rgba(255,255,255,.55); transition: transform .08s, filter .15s; }
.tier:hover { filter: brightness(1.06); }
.tier:active { transform: translateY(2px) scale(.99); }
.tier:disabled { opacity: .5; cursor: default; }

/* tela de fim — valor perdido (vermelho) / coletado (dourado) */
#finalScore.lost-amount { color: #ff5a7a; text-shadow: 0 0 18px rgba(255,90,122,.55); animation: lostPop .6s ease; }
#finalScore.collected-amount { color: var(--gold); text-shadow: 0 0 20px rgba(255,210,63,.6); animation: collectedPop .6s ease; }
@keyframes lostPop { 0% { transform: scale(1.15); opacity: .4 } 100% { transform: scale(1); opacity: 1 } }
@keyframes collectedPop { 0% { transform: scale(.6); opacity: 0 } 60% { transform: scale(1.12) } 100% { transform: scale(1); opacity: 1 } }
.d-lost { color: #ff6a8a; font-size: 13px; font-weight: 700; margin: 2px 0 10px; }
.d-lost.hidden { display: none; }

@media (max-width: 560px) {
  .hw { min-width: 46px; padding: 1px 6px; } .hw b { font-size: 13px; } .hw span { font-size: 7.5px; }
  #collectBtn { bottom: 30px; padding: 9px 18px; font-size: 13px; }
}

/* moedas douradas da animação de prêmio */
.coin { position: fixed; width: 16px; height: 16px; border-radius: 50%; pointer-events: none; z-index: 8;
  background: radial-gradient(circle at 35% 30%, #fff3b0, #ffcf33 55%, #d99e00); box-shadow: 0 0 10px rgba(255,210,63,.85);
  animation: coinFly .95s ease-out forwards; }
@keyframes coinFly { 0% { transform: translate(0,0) scale(.5); opacity: 0 } 15% { opacity: 1 }
  100% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0 } }
@media (prefers-reduced-motion: reduce){ .coin { animation-duration: .01s } }
