:root {
  --ink: #f4efe6;
  --dim: #b9b0a6;
  --panel: rgba(9, 16, 38, 0.9);
  --edge: rgba(255, 255, 255, 0.1);
  --good: #2fa8ff;
  --bad: #ff4a4a;
  --gold: #ffc23d;
  --accent: #3b8bff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #120d12;
  color: var(--ink);
  font-family: 'Rajdhani', system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
#game:active {
  cursor: grabbing;
}

#labels,
#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
#labels > * {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

/* ---------- world labels ---------- */

.squad-count {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: 26px;
  padding: 2px 14px 4px;
  border-radius: 12px;
  background: linear-gradient(180deg, #3cb4ff, #1167c9);
  color: white;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  box-shadow: 0 4px 0 #0b3f7a, 0 6px 18px rgba(0, 0, 0, 0.45);
  min-width: 44px;
  text-align: center;
}
.squad-count::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -9px;
  margin-left: -7px;
  border: 7px solid transparent;
  border-top-color: #0b3f7a;
  border-bottom: 0;
}
.squad-count.bump-up {
  animation: bumpUp 0.35s ease-out;
}
.squad-count.bump-down {
  animation: bumpDown 0.35s ease-out;
}
@keyframes bumpUp {
  40% {
    scale: 1.35;
    filter: brightness(1.6);
  }
}
@keyframes bumpDown {
  30% {
    scale: 1.2;
    background: linear-gradient(180deg, #ff6a5a, #c4231b);
  }
}

.hp-label {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: 13px;
  color: #fff;
  background: rgba(150, 20, 20, 0.85);
  padding: 0 6px;
  border-radius: 6px;
  text-shadow: 0 1px 0 #000;
}
.hp-label.fast {
  background: rgba(190, 80, 10, 0.88);
}
.hp-label.big {
  font-size: 18px;
  padding: 1px 9px;
  background: rgba(100, 0, 40, 0.92);
  border: 2px solid rgba(255, 120, 120, 0.6);
}

.float-text {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: 34px;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5), 0 0 18px rgba(255, 255, 255, 0.4);
}
.float-text.good {
  color: #8fd6ff;
  text-shadow: 0 3px 0 #0b3f7a, 0 0 20px rgba(60, 170, 255, 0.8);
}
.float-text.bad {
  color: #ff8a80;
  text-shadow: 0 3px 0 #6a0e0e, 0 0 20px rgba(255, 60, 60, 0.8);
}
.float-text.coin {
  font-size: 22px;
  color: var(--gold);
  text-shadow: 0 2px 0 #6a4600;
}
.float-text.coin.big {
  font-size: 40px;
}

/* ---------- shared UI ---------- */

.screen,
.hud button,
.btn,
.icon-btn {
  pointer-events: auto;
}

.btn {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: 17px;
  color: var(--ink);
  background: linear-gradient(180deg, #3a3238, #241e24);
  border: 1px solid var(--edge);
  border-bottom: 4px solid #120e12;
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.08s, filter 0.15s;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.btn:hover:not(:disabled) {
  filter: brightness(1.25);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) {
  transform: translateY(2px);
  border-bottom-width: 2px;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn small {
  font-family: 'Rajdhani', sans-serif;
  font-size: 12px;
  color: var(--dim);
}
.btn.primary {
  /* azul da Legião com o filete dourado do escudo */
  background: linear-gradient(180deg, #4f8dff, #1e4fd8);
  border-bottom-color: #0d2a80;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28), 0 0 0 2px #ffc43d;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}
.btn.big {
  padding: 16px 40px;
}
.btn-k {
  font-size: 34px;
  line-height: 1;
}
.btn-sub {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 15px;
  opacity: 0.9;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--edge);
  background: rgba(20, 16, 20, 0.7);
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.coins {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: 20px;
  color: var(--gold);
  background: rgba(20, 16, 20, 0.7);
  padding: 6px 14px;
  border-radius: 12px;
  border: 1px solid var(--edge);
  backdrop-filter: blur(6px);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

kbd {
  font-family: inherit;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
  font-size: 0.9em;
}

/* ---------- menu ---------- */

.menu {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 22px;
  background: radial-gradient(ellipse at 50% 40%, transparent 30%, rgba(10, 6, 10, 0.55) 100%);
  pointer-events: none;
}
.menu > * {
  pointer-events: auto;
}
.topbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.title {
  text-align: center;
  margin-top: -4vh;
  pointer-events: none;
}
.title .t1 {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: clamp(44px, 9vw, 104px);
  line-height: 0.95;
  background: linear-gradient(180deg, #ffffff 12%, #cfe4ff 52%, #5f9bff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 5px 0 #0b2a7a) drop-shadow(0 10px 26px rgba(20, 60, 180, 0.55));
}
/* escudo do tridente (o ícone do jogo), em cima do nome */
.title .escudo {
  display: block;
  width: clamp(64px, 17vw, 110px);
  height: auto;
  margin: 0 auto 6px;
  filter: drop-shadow(0 5px 0 rgba(8, 24, 80, 0.75));
}
.title .t2 {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: clamp(18px, 3vw, 32px);
  letter-spacing: 0.5em;
  margin-top: 8px;
  padding-left: 0.5em;
  color: #ffd76a;
  text-shadow: 0 3px 0 rgba(6, 18, 60, 0.85);
}
.menu-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.menu-actions .row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.hint {
  font-size: 14px;
  color: var(--dim);
  text-align: center;
  text-shadow: 0 1px 2px #000;
}

/* ---------- panels ---------- */

.panel-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 6, 10, 0.5);
  backdrop-filter: blur(3px);
}
.panel {
  width: min(760px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--edge);
}
.panel-head h2 {
  flex: 1;
  margin: 0;
  font-family: 'Bungee', Impact, sans-serif;
  font-weight: 400;
  font-size: 24px;
}
.panel-body {
  overflow-y: auto;
  padding: 16px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.level {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--edge);
  border-bottom: 4px solid #0d0a0d;
  background: linear-gradient(180deg, #3b2f2a, #261d1b);
  color: var(--ink);
  font-family: 'Rajdhani', sans-serif;
  cursor: pointer;
  text-align: left;
}
.level:hover:not(:disabled) {
  filter: brightness(1.2);
}
.level.done {
  background: linear-gradient(180deg, #2a3d2a, #1a271b);
}
.level.boss {
  border-color: rgba(255, 90, 60, 0.5);
}
.level.locked {
  opacity: 0.45;
  cursor: not-allowed;
}
.level .n {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: 28px;
}
.level .nm {
  font-weight: 700;
  font-size: 16px;
}
.level .bs {
  font-size: 12px;
  color: #ff9a8a;
}

.shop h3 {
  font-family: 'Bungee', Impact, sans-serif;
  font-weight: 400;
  margin: 4px 0 10px;
  color: var(--accent);
}
.upgrades,
.heroes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--edge);
}
.card.selected {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
}
.card .ic {
  font-size: 28px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  flex: none;
}
.card .hero-ic {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: 24px;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}
.card .info {
  flex: 1;
  min-width: 0;
}
.card .nm {
  font-weight: 700;
  font-size: 18px;
}
.card .lv {
  font-size: 13px;
  color: var(--gold);
  margin-left: 6px;
}
.card .ds {
  font-size: 14px;
  color: var(--dim);
  line-height: 1.2;
}
.pips {
  display: flex;
  gap: 3px;
  margin-top: 6px;
}
.pips i {
  width: 10px;
  height: 6px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
}
.pips i.on {
  background: var(--accent);
}
.btn.buy {
  font-size: 14px;
  padding: 10px 12px;
  min-width: 96px;
  flex: none;
}
.btn.buy.sel {
  background: linear-gradient(180deg, #4a6a2a, #2d4418);
}

/* ---------- HUD ---------- */

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hud-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
}
.lvl {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.lvl-name {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: 15px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
  text-align: center;
}
.prog {
  position: relative;
  width: min(360px, 60vw);
  height: 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--edge);
}
.prog .fill {
  height: 100%;
  width: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, #3cb4ff, #8fe1ff);
  box-shadow: 0 0 10px rgba(60, 180, 255, 0.6);
}
.prog .skull {
  position: absolute;
  right: -12px;
  top: -8px;
  font-size: 20px;
  filter: drop-shadow(0 0 6px red);
}
.dist {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: 26px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.6);
}
.hidden {
  display: none !important;
}

.bossbar {
  position: absolute;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 86vw);
  text-align: center;
  animation: dropIn 0.5s ease-out;
}
/* na luta de chefe o selo da arma sai: ele ficava por cima do nome do chefe, e a arma não muda durante a luta */
.hud-top:has(+ .bossbar:not(.hidden)) .gun-badge {
  visibility: hidden;
}
.bname {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: 22px;
  color: #ff6a5a;
  text-shadow: 0 2px 0 #3a0000, 0 0 16px rgba(255, 40, 20, 0.7);
  margin-bottom: 4px;
}
.bbar {
  position: relative;
  height: 18px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 90, 70, 0.6);
  overflow: hidden;
}
.bfill,
.btrail {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
}
.btrail {
  background: #fff3c0;
  opacity: 0.7;
}
.bfill {
  z-index: 1;
  background: linear-gradient(180deg, #ff5a3c, #b0150c);
}
@keyframes dropIn {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
}

.tips {
  position: absolute;
  bottom: 7%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.toasts {
  position: absolute;
  top: 17%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.toast {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: 22px;
  padding: 8px 22px;
  border-radius: 12px;
  background: rgba(10, 8, 12, 0.7);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
  animation: toast 2.3s ease-out forwards;
  text-align: center;
}
.toast.big {
  font-size: clamp(22px, 4vw, 36px);
  background: none;
  color: #ffe2b0;
  text-shadow: 0 3px 0 #3a1406, 0 0 24px rgba(255, 120, 40, 0.6);
}
.toast.boss {
  font-size: clamp(28px, 6vw, 54px);
  background: none;
  color: #ff5a4a;
  text-shadow: 0 4px 0 #2a0000, 0 0 30px rgba(255, 30, 20, 0.9);
}
@keyframes toast {
  0% {
    opacity: 0;
    transform: scale(1.6);
  }
  12% {
    opacity: 1;
    transform: scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* ---------- overlays ---------- */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 5, 8, 0.55);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
}
.modal {
  width: min(460px, 100%);
  padding: 26px 22px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--edge);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  text-align: center;
}
.modal h1,
.modal h2 {
  font-family: 'Bungee', Impact, sans-serif;
  font-weight: 400;
  margin: 0;
}
.modal h1 {
  font-size: clamp(40px, 9vw, 60px);
  line-height: 1;
}
.result.win h1 {
  color: #ffd25a;
  text-shadow: 0 4px 0 #6a3a00, 0 0 30px rgba(255, 190, 60, 0.6);
}
.result.lose h1 {
  color: #ff5a4a;
  text-shadow: 0 4px 0 #3a0000, 0 0 30px rgba(255, 40, 30, 0.6);
}
.modal .sub {
  color: var(--dim);
  font-size: 17px;
  margin-top: -4px;
}
.modal .sub b {
  color: var(--gold);
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 6px 0;
}
.stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}
.stats span {
  font-size: 20px;
}
.stats b {
  font-family: 'Bungee', Impact, sans-serif;
  font-weight: 400;
  font-size: 22px;
}
.stats small {
  color: var(--dim);
  font-size: 13px;
}
.earned {
  font-size: 18px;
}
.earned b {
  font-family: 'Bungee', Impact, sans-serif;
  font-weight: 400;
  font-size: 34px;
  color: var(--gold);
  text-shadow: 0 3px 0 #6a4600;
}
.earned small {
  display: block;
  color: var(--dim);
  font-size: 13px;
}
.btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 560px) {
  .btn {
    font-size: 15px;
    padding: 10px 14px;
  }
  .upgrades,
  .heroes {
    grid-template-columns: 1fr;
  }
  .squad-count {
    font-size: 20px;
  }
  .float-text {
    font-size: 26px;
  }
  .hud-top .coins {
    font-size: 16px;
  }
  .lvl-name {
    font-size: 12px;
  }
}

/* ---------- guns, tips, stars ---------- */

.gun-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px;
  border-radius: 10px;
  background: rgba(20, 16, 20, 0.7);
  border: 1px solid rgba(255, 190, 60, 0.35);
  font-family: 'Bungee', Impact, sans-serif;
  font-size: 13px;
  color: #ffd27a;
  text-shadow: 0 1px 0 #000;
}
.gun-badge.bump {
  animation: gunBump 0.6s ease-out;
}
@keyframes gunBump {
  30% {
    scale: 1.35;
    box-shadow: 0 0 24px rgba(255, 190, 60, 0.9);
  }
}
.gpips {
  display: flex;
  gap: 3px;
}
.gpips i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
}
.gpips i.on {
  background: #ffb21e;
  box-shadow: 0 0 6px #ffb21e;
}

.toast.tip {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: clamp(16px, 2.4vw, 22px);
  background: rgba(30, 22, 8, 0.85);
  border: 1px solid rgba(255, 200, 80, 0.6);
  color: #ffe6a8;
  animation-duration: 4.2s;
  max-width: 92vw;
}
.toast.gun {
  font-size: clamp(22px, 4.5vw, 38px);
  background: none;
  color: #ffd25a;
  text-shadow: 0 3px 0 #5a3200, 0 0 26px rgba(255, 180, 40, 0.9);
}
.float-text.gold {
  color: #ffd25a;
  text-shadow: 0 3px 0 #5a3200, 0 0 20px rgba(255, 190, 60, 0.9);
}

.level .st {
  font-size: 15px;
  color: #ffc23d;
  letter-spacing: 2px;
}
.stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  font-size: 46px;
  line-height: 1;
}
.stars span {
  color: rgba(255, 255, 255, 0.15);
}
.stars span.on {
  color: #ffc23d;
  text-shadow: 0 0 18px rgba(255, 190, 60, 0.8);
  animation: starPop 0.45s ease-out both;
}
@keyframes starPop {
  from {
    transform: scale(2.4);
    opacity: 0;
  }
}
.gunline {
  color: var(--dim);
  font-size: 16px;
}
.gunline b {
  color: #ffd27a;
  font-family: 'Bungee', Impact, sans-serif;
  font-weight: 400;
}
.starhint {
  font-size: 14px;
  color: #ffd27a;
}

/* ---------- ícones SVG (substituem os emojis da interface original) ---------- */

.ico {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  flex: none;
}
.ico-moeda {
  color: var(--gold);
}
.ico-estrela.off {
  opacity: 0.22;
}
.icon-btn .ico {
  width: 22px;
  height: 22px;
  vertical-align: middle;
}
.card .ic .ico {
  width: 28px;
  height: 28px;
  color: #ffd27a;
}
.level .n .ico {
  opacity: 0.7;
}
.prog .skull .ico {
  width: 20px;
  height: 20px;
  color: #ffb3a8;
}
.stats span .ico {
  width: 22px;
  height: 22px;
  color: #cfd8e6;
}
.stars .ico {
  width: 46px;
  height: 46px;
}
.gun-badge .ico {
  width: 15px;
  height: 15px;
}
.btn.buy {
  flex-direction: row;
  justify-content: center;
  gap: 6px;
}
.btn.buy.sel {
  background: linear-gradient(180deg, #2f6fd0, #1c3f80);
}

/* ---------- ajustes da revisão de 13/10 ---------- */

/* o clique num ícone vale para o botão (senão o som do clique some quando o ícone é trocado) */
.ico {
  pointer-events: none;
}
/* nome da arma em uma linha só no selo do HUD */
.gun-badge,
.gun-badge .gname {
  white-space: nowrap;
}
/* botões da tela de resultado: ícone ao lado do texto, todos da mesma altura */
.btns .btn {
  flex-direction: row;
  justify-content: center;
  gap: 6px;
}
/* brilho das estrelas conquistadas (text-shadow não vale para SVG) */
.stars span.on .ico {
  filter: drop-shadow(0 0 9px rgba(255, 190, 60, 0.8));
}
/* janela de resultado mais alta que a tela: rola em vez de cortar os botões */
.overlay {
  align-items: flex-start;
  overflow-y: auto;
  touch-action: pan-y;
}
.overlay > .modal {
  margin: auto;
}
@media (max-width: 560px) {
  .gun-badge {
    font-size: 11px;
    gap: 6px;
    padding: 3px 8px;
  }
}
@media (max-width: 560px) {
  /* subtítulo do menu em uma linha no celular */
  .title .t2 {
    letter-spacing: 0.15em;
    padding-left: 0.15em;
  }
}

/* ---------- moedas em voo, fim de fase e resultado encenado ---------- */

/* estoque fixo de moedas (ui/moedas.js): posição, escala e visibilidade de cada uma são escritas pelo jogo */
.moedas-voo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.moeda-voo {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #fff6c4 0 14%, #ffd24a 40%, #e39b14 78%, #b06d06 100%);
  box-shadow: inset 0 0 0 2px rgba(122, 72, 0, 0.55), 0 2px 0 rgba(0, 0, 0, 0.35);
  visibility: hidden;
  will-change: transform;
}
.moeda-voo::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 2px solid rgba(122, 72, 0, 0.4);
}
/* contador recebendo moeda: o pulo (scale) vem do ui.js; aqui só o brilho */
.hud .coins.moedas-cheio {
  border-color: rgba(255, 196, 61, 0.9);
  box-shadow: 0 0 16px rgba(255, 190, 60, 0.6);
}

/* fim de fase antes do painel: opacidade e movimento escritos pelo jogo (ui.js, passoFim) */
.fim-fase {
  position: absolute;
  pointer-events: none;
  opacity: 0;
}
.faixa-fim {
  left: 0;
  right: 0;
  top: 30%;
  padding: 10px 0 14px;
  text-align: center;
  background: linear-gradient(90deg, rgba(6, 10, 30, 0), rgba(6, 10, 30, 0.72) 18%, rgba(6, 10, 30, 0.72) 82%, rgba(6, 10, 30, 0));
}
.faixa-fim::before,
.faixa-fim::after {
  content: '';
  position: absolute;
  left: 12%;
  right: 12%;
  height: 2px;
  background: linear-gradient(90deg, rgba(255, 196, 61, 0), #ffc43d 30%, #ffc43d 70%, rgba(255, 196, 61, 0));
}
.faixa-fim::before {
  top: 0;
}
.faixa-fim::after {
  bottom: 0;
}
/* o chefe derrotado, na cor dele (--chefe-luz, posta no HUD pelo cartão de apresentação) */
.ff-sub {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.26em;
  padding-left: 0.26em;
  white-space: nowrap;
  color: var(--chefe-luz, #ffe2b0);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}
.ff-txt {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: clamp(48px, 15vw, 104px);
  line-height: 1;
  white-space: nowrap;
  color: #ffd25a;
  text-shadow: 0 5px 0 #6a3a00, 0 0 28px rgba(255, 190, 60, 0.6);
  will-change: transform;
}
/* derrota: só as bordas escurecem, em gradiente simples (sem filtro por cima do jogo) */
.vinheta-fim {
  inset: 0;
  background: radial-gradient(ellipse at 50% 45%, rgba(120, 0, 0, 0) 40%, rgba(120, 0, 0, 0.55) 100%);
}
@media (orientation: landscape) and (max-height: 560px) {
  .faixa-fim {
    top: 22%;
  }
}

/* Resultado: sem desfoque por cima do jogo (pesa no Android) e com o alto da tela mais claro, onde a festa ou o
   capacete aparecem. Opacidade e posição do painel, das estrelas e dos botões são escritas pelo jogo (desenhaEncena). */
.result.encenado {
  background: linear-gradient(180deg, rgba(8, 5, 8, 0.06) 0%, rgba(8, 5, 8, 0.38) 40%, rgba(8, 5, 8, 0.72) 100%);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  animation: none;
}
.result.encenado.lose {
  background: radial-gradient(ellipse at 50% 32%, rgba(120, 0, 0, 0) 38%, rgba(120, 0, 0, 0.5) 100%), linear-gradient(180deg, rgba(8, 5, 8, 0.1) 0%, rgba(8, 5, 8, 0.42) 40%, rgba(8, 5, 8, 0.74) 100%);
}
.result.encenado .stars span.on {
  animation: none;
}
/* estrela ganha que ainda não bateu: apagada como as outras */
.result.encenado .stars span.on.espera {
  color: rgba(255, 255, 255, 0.15);
  text-shadow: none;
}
.result.encenado .stars span.on.espera .ico {
  filter: none;
}
.result.encenado .btns.trava .btn {
  pointer-events: none;
}
/* contagem pronta: o botão principal pulsa. Só a escala anda: sombra animada repinta o botão a cada quadro no
   celular, então o brilho fica parado */
.btn.primary.chama {
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28), 0 0 0 2px #ffc43d, 0 0 18px rgba(255, 196, 61, 0.5);
  animation: chamaBotao 1.4s ease-in-out infinite;
}
@keyframes chamaBotao {
  50% {
    scale: 1.04;
  }
}
.chefe-vencido {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -2px;
}
.cv-rot {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.24em;
  color: var(--chefe-luz, #ffe2b0);
}
.cv-rot::before,
.cv-rot::after {
  content: '';
  width: 26px;
  height: 2px;
  background: var(--chefe, #ff5a4a);
}
.cv-nome {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: clamp(26px, 7.5vw, 36px);
  line-height: 1.05;
  background: linear-gradient(180deg, var(--chefe-luz, #ffe2b0) 18%, var(--chefe, #ff5a4a) 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.falta {
  font-weight: 700;
  font-size: 17px;
  color: #ffb3a8;
  margin-top: -4px;
}
/* em pé: o painel fica embaixo, perto do polegar, e o terço de cima mostra o jogo (acima da barra de gestos) */
@media (orientation: portrait) {
  .result.encenado {
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }
  .result.encenado > .modal {
    margin: auto auto 0;
    gap: 10px;
    padding: 20px 18px 18px;
  }
}

/* ---------- skins (cor do uniforme) ---------- */

.skins {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); /* 3 colunas num celular de 360 px */
  gap: 10px;
}
.skin {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px 10px;
  border-radius: 14px;
  border: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
}
/* sem moedas: apaga o nome e o preço, mas a amostra de cor continua viva (é a vitrine) */
.skin:disabled {
  cursor: not-allowed;
}
.skin:disabled .nm,
.skin:disabled .pr {
  opacity: 0.45;
}
.skin.confirma {
  border-color: #6fe08a;
  box-shadow: inset 0 0 0 1px #6fe08a;
}
.skin.confirma .pr {
  color: #6fe08a;
}
.skin.selected {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
}
.skin .amostra {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--cor);
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
}
/* skin do líder: metade farda, metade capa */
.skin .amostra.lider {
  background: linear-gradient(90deg, var(--cor) 50%, var(--capa) 50%);
}
.skin.arcoiris .amostra {
  background: conic-gradient(#ff4f4f, #ffc43d, #23b06a, #2f6bff, #7c4dff, #ff4fa3, #ff4f4f);
}
.skin .nm {
  font-size: 14px;
  line-height: 1.1;
  text-align: center;
}
.skin .pr {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: 12px;
  color: var(--gold);
  white-space: nowrap;
}
.skin.selected .pr {
  color: #9fd0ff;
}

/* dica de fase: no celular o texto em português não cabia numa linha e saía cortado nas duas bordas */
.toast.tip {
  white-space: normal;
  max-width: 92vw;
  box-sizing: border-box;
  text-align: center;
  line-height: 1.2;
}
@media (max-width: 560px) {
  .toast.tip {
    font-size: 15px;
    padding: 8px 12px;
  }
  .toast.big {
    font-size: 26px;
  }
  .toast.boss {
    font-size: 30px;
  }
}

/* a dica ocupa quase a largura da tela: entra de leve, sem o salto de 160% dos outros avisos (que a cortava nas bordas) */
@keyframes dica {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(1.04);
  }
  10% {
    opacity: 1;
    transform: none;
  }
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-12px);
  }
}
.toast.tip {
  animation-name: dica;
}

/* ---------- portão e arma nova ---------- */

/* esquadrão maior que os bonecos que cabem na tela: o ganho não aparece em soldados, então o balão pula mais */
.squad-count.bump-up.bump-mais {
  animation: bumpMais 0.5s ease-out;
}
@keyframes bumpMais {
  35% {
    scale: 1.75;
    filter: brightness(1.9);
  }
}

/* arma nova: cartão sem fundo (não tapa a pista), mais curto que os outros avisos */
.toast.arma {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0;
  background: none;
  color: #ffd25a;
  animation: armaCartao 1.7s ease-out forwards;
}
.arma-rot {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  letter-spacing: 3px;
  color: #fff3c0;
}
.arma-rot::before,
.arma-rot::after {
  content: '';
  width: 34px;
  height: 2px;
  background: #ffd25a;
  animation: armaRisco 0.35s ease-out both;
}
.arma-rot::before {
  transform-origin: right;
}
.arma-rot::after {
  transform-origin: left;
}
.arma-nome {
  font-size: clamp(26px, 7vw, 42px);
  line-height: 1.05;
  text-shadow: 0 3px 0 #5a3200, 0 0 26px rgba(255, 180, 40, 0.9);
}
.arma-pips {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.arma-pips i {
  width: 16px;
  height: 6px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.22);
}
.arma-pips i.on {
  background: #ffb21e;
  box-shadow: 0 0 6px #ffb21e;
}
.arma-pips i.novo {
  animation: armaPip 0.5s 0.25s ease-out both;
}
@keyframes armaCartao {
  0% {
    opacity: 0;
    transform: scale(1.5);
  }
  9% {
    opacity: 1;
    transform: scale(1);
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-16px);
  }
}
@keyframes armaRisco {
  from {
    transform: scaleX(0);
  }
}
@keyframes armaPip {
  0% {
    transform: scale(0.2);
    background: #ffffff;
  }
  50% {
    transform: scale(1.9);
    background: #fff7d6;
  }
  100% {
    transform: scale(1);
  }
}
/* clarão dourado só nos cantos: o centro da tela (pista, inimigos, próximo portão) fica limpo */
.borda-arma {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse farthest-corner at center, rgba(255, 190, 60, 0) 60%, rgba(255, 190, 60, 0.5) 100%);
  animation: bordaArma 0.6s ease-out forwards;
}
@keyframes bordaArma {
  0% {
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* ---------- entrada do chefe: cartão de apresentação ---------- */

/* Capítulo em cima (pequeno) e nome do chefe embaixo (grande), nas cores dele: --chefe, --chefe-luz e
   --chefe-sombra, postas no HUD pelo ui.js (bossCard). Fica logo abaixo da barra de vida e some sozinho;
   o terço de baixo da tela continua livre para o esquadrão. */
.boss-card {
  position: absolute;
  left: 0;
  right: 0;
  top: max(17%, 140px);
  padding: 9px 14px 12px;
  text-align: center;
  background: linear-gradient(90deg, rgba(6, 8, 16, 0), rgba(6, 8, 16, 0.74) 20%, rgba(6, 8, 16, 0.74) 80%, rgba(6, 8, 16, 0));
  animation: cartaoChefe 2.2s ease-out both;
}
.bc-cap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  font-size: clamp(13px, 3.5vw, 20px);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--chefe-luz, #ffe2b0);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}
/* o espaçamento entre letras sobra depois da última: sem compensar, o texto sai do centro */
.bc-cap span {
  margin-right: -0.26em;
}
.bc-cap::before,
.bc-cap::after {
  content: '';
  flex: 0 1 34px;
  height: 2px;
  background: var(--chefe, #ff5a4a);
}
.bc-nome {
  font-family: 'Bungee', Impact, sans-serif;
  font-size: clamp(34px, min(11.5vw, 11vh), 88px);
  line-height: 1.05;
  white-space: nowrap;
  background: linear-gradient(180deg, var(--chefe-luz, #ffe2b0) 18%, var(--chefe, #ff5a4a) 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 var(--chefe-sombra, #2a0000));
  animation: nomeChefe 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.25) 0.08s both;
}
@keyframes cartaoChefe {
  0% {
    opacity: 0;
    transform: translateX(-28px) skewX(-8deg);
  }
  9% {
    opacity: 1;
    transform: none;
  }
  82% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    transform: translateX(24px);
  }
}
@keyframes nomeChefe {
  from {
    opacity: 0;
    transform: scale(1.5);
  }
}
/* jogo pausado: o cartão espera junto */
.hud:has(~ .pause) .boss-card,
.hud:has(~ .pause) .bc-nome {
  animation-play-state: paused;
}
/* celular deitado: não há altura entre a barra de vida e o chefe; o cartão vai para a esquerda, ao lado dele */
@media (orientation: landscape) and (max-height: 560px) {
  .boss-card {
    right: auto;
    top: max(42%, 128px);
    width: min(48vw, 460px);
    padding-left: max(18px, 4vw);
    text-align: left;
    background: linear-gradient(90deg, rgba(6, 8, 16, 0.78) 45%, rgba(6, 8, 16, 0));
  }
  .bc-cap {
    justify-content: flex-start;
  }
  .bc-cap::before {
    display: none;
  }
  .bc-nome {
    transform-origin: left center;
  }
}
/* a barra de vida leva as cores do chefe da vez (sem as variáveis vale o vermelho de sempre) */
.bname {
  color: var(--chefe-luz, #ff6a5a);
  text-shadow: 0 2px 0 var(--chefe-sombra, #3a0000), 0 0 3px var(--chefe-sombra, #3a0000), 0 0 3px var(--chefe-sombra, #3a0000), 0 0 16px var(--chefe, rgba(255, 40, 20, 0.7));
}
.bbar {
  border-color: var(--chefe, rgba(255, 90, 70, 0.6));
}
.bfill {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.4)), var(--chefe, #e0402a);
}

/* ---------- HUD legível: topo sobre qualquer fundo, nada abaixo de 14 px, dicas longe do polegar ---------- */

/* --topo é a borda de cima do HUD: barra do chefe, cartão, dicas e avisos contam dela. Os env() do HUD valem 0
   enquanto o index.html não pede viewport-fit=cover. Ligar o cover pede antes a margem de baixo na pausa e no
   resultado: no Android de tela inteira o botão de baixo cairia sob a barra de navegação do sistema. */
.hud {
  --topo: max(14px, env(safe-area-inset-top, 0px));
}

/* Faixa escura atrás do topo: barra, selo e moedas ficavam sobre o céu claro e o brilho do mar. Clareia aos
   poucos para baixo, sem borda. O .hud-top ganha posição só para ficar por cima dela. */
.hud::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: calc(min(136px, 22vh) + env(safe-area-inset-top, 0px));
  background: linear-gradient(180deg, rgba(6, 10, 24, 0.66), rgba(6, 10, 24, 0.36) 55%, rgba(6, 10, 24, 0));
  pointer-events: none;
}
.hud-top {
  position: relative;
  padding: var(--topo) max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px));
}

/* Desfoque de fundo sobre o canvas obriga o navegador do celular a recompor aquele pedaço a cada quadro. No HUD o
   fundo fica sólido, mais escuro para ler igual. O :where() não pesa: qualquer regra de .coins continua valendo. */
:where(.hud) .icon-btn,
:where(.hud) .coins {
  backdrop-filter: none;
  background: rgba(14, 12, 20, 0.84);
}

/* nada do HUD abaixo de 14 px */
.gun-badge {
  font-size: 14px;
}
.arma-rot {
  font-size: 14px;
}
.bc-cap {
  font-size: clamp(14px, 3.5vw, 20px);
}
.hp-label {
  font-size: 15px;
  padding: 1px 7px;
}

/* balão do esquadrão menor: ele fica sobre a faixa por onde chegam portão e inimigo */
.squad-count {
  font-size: 22px;
  padding: 1px 11px 3px;
  min-width: 38px;
  border-radius: 10px;
}

.bossbar {
  top: calc(var(--topo) + 60px);
}
.boss-card {
  top: max(17%, calc(var(--topo) + 126px));
}
/* Dicas no alto, logo abaixo do topo: embaixo ficavam sob o polegar e em cima do esquadrão. Os avisos descem o
   bastante para não encostar numa dica de duas linhas (a primeira dica sai junto com o aviso de começo de fase). */
.tips {
  top: calc(var(--topo) + 78px);
  bottom: auto;
}
.toasts {
  top: max(17%, calc(var(--topo) + 124px));
}

@media (max-width: 560px), (max-height: 560px) {
  /* celular: o topo perde uma linha. O nome da fase já aparece no aviso grande do começo e na pausa. */
  .lvl-name {
    display: none;
  }
  .tips {
    top: calc(var(--topo) + 62px);
  }
}
@media (max-width: 560px) {
  .squad-count {
    font-size: 18px;
  }
  /* A barra ocupa o que sobra entre a pausa e as moedas, e encurta quando o contador ganha um dígito: com 60vw ela
     empurrava as moedas para fora de uma tela de 360 px, e com largura fixa a caveira encostava nelas a partir de
     1.000 moedas. A margem é o lugar da caveira, que passa 12 px da ponta da barra. */
  .lvl {
    min-width: 0;
  }
  .prog {
    width: auto;
    align-self: stretch;
    margin: 0 12px;
  }
  /* selo em duas linhas, nome em cima e degraus embaixo, como no cartão de arma nova: em 14 px o nome das
     armas mais altas não cabia ao lado dos degraus */
  .gun-badge {
    flex-direction: column;
    gap: 3px;
    padding: 3px 10px 4px;
  }
  .gpips i {
    width: 12px;
    height: 4px;
  }
}
/* repete a posição do cartão no celular deitado (a regra de cima a cobriria); o env() é o mesmo cuidado do --topo */
@media (orientation: landscape) and (max-height: 560px) {
  .boss-card {
    top: max(42%, 128px);
    padding-left: max(18px, 4vw, calc(env(safe-area-inset-left, 0px) + 8px));
  }
  /* Deitado, 138 px cai sobre o próximo portão entre 22 e 12 m, a hora de escolher: os avisos voltam para logo
     abaixo do topo (66 px, sobre o portão ainda longe) e as dicas vão para a coluna da esquerda, fora da pista. */
  .toasts {
    top: calc(var(--topo) + 52px);
  }
  .tips {
    top: max(42%, 128px);
    right: auto;
    width: min(30vw, 260px);
    padding-left: max(16px, 3vw);
    align-items: flex-start;
  }
}

/* medidor de desempenho, ligado por ?fps=1 */
.medidor {
  position: fixed;
  left: 6px;
  bottom: 6px;
  z-index: 50;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: #9dff8a;
  font: 700 12px/1.3 ui-monospace, Menlo, monospace;
  pointer-events: none;
}
