* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #FFD6E8;
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-weight: 800;
}

canvas { display: block; }

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

/* ---------- Logo topo ---------- */
#logo {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-shadow: 0 2px 0 #C74A8F, 0 4px 0 #8A2C63, 0 6px 12px rgba(0,0,0,.35);
  -webkit-text-stroke: 1.5px #8A2C63;
  pointer-events: none;
  white-space: nowrap;
}

/* ---------- Contador de vivos ---------- */
#topBar {
  position: absolute;
  top: 52px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.4));
}

#skullIcon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF8AC7, #D64FA0);
  border: 3px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(214,79,160,.5);
}

#brawlersLeft {
  color: #fff;
  font-size: 18px;
  text-shadow: 0 2px 0 #8A2C63, 0 0 8px rgba(0,0,0,.4);
}

/* ---------- Cards dos inimigos ---------- */
#enemyList {
  position: absolute;
  top: 100px;
  left: 14px;
  display: flex;
  gap: 6px;
}

.enemyCard {
  background: rgba(255,240,248,.94);
  border: 2px solid #D64FA0;
  border-radius: 8px;
  padding: 4px 6px;
  min-width: 70px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.enemyCard .name {
  color: #4A1F38;
  font-size: 11px;
  line-height: 1;
}

.enemyCard .bar {
  height: 5px;
  background: #FFD6E8;
  border-radius: 3px;
  overflow: hidden;
}

.enemyCard .bar > div {
  height: 100%;
  background: linear-gradient(90deg, #FF6BB0, #D64FA0);
  transition: width .15s;
}

/* ---------- Joystick ---------- */
.joy {
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255,255,255,.28);
  border: 4px solid rgba(255,255,255,.7);
  pointer-events: auto;
  touch-action: none;
  box-shadow: inset 0 0 20px rgba(214,79,160,.2), 0 3px 12px rgba(0,0,0,.15);
}

#joyL {
  bottom: 20px;
  left: 20px;
}

.knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFD1E8, #D64FA0);
  border: 3px solid #fff;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 3px 10px rgba(0,0,0,.35);
}

.arrow {
  position: absolute;
  color: rgba(255,255,255,.9);
  font-size: 16px;
  pointer-events: none;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(138,44,99,.6);
}

.arrow.up    { top: 8px;    left: 50%;  transform: translateX(-50%); }
.arrow.down  { bottom: 8px; left: 50%;  transform: translateX(-50%); }
.arrow.left  { left: 8px;   top: 50%;   transform: translateY(-50%); }
.arrow.right { right: 8px;  top: 50%;   transform: translateY(-50%); }

/* ---------- Botão Super ---------- */
#superBtn {
  position: absolute;
  bottom: 190px;
  right: 32px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #B79BFF, #6A3CE8);
  border: 4px solid #F0E4FF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  pointer-events: auto;
  touch-action: none;
  opacity: .35;
  transition: opacity .2s, transform .15s;
  box-shadow: 0 0 20px rgba(106,60,232,.4);
}

#superBtn.ready {
  opacity: 1;
  animation: superPulse 1.4s ease-in-out infinite;
}

#superBtn:active {
  transform: scale(.92);
}

@keyframes superPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(106,60,232,.4); }
  50%      { box-shadow: 0 0 34px rgba(150,110,255,.95); }
}

/* ---------- Botão de ataque ---------- */
#attackBtn {
  position: absolute;
  bottom: 40px;
  right: 40px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FF9BC9, #C7207A);
  border: 5px solid #FFE4F2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  pointer-events: auto;
  touch-action: none;
  box-shadow: 0 4px 15px rgba(0,0,0,.35);
  transition: transform .12s, box-shadow .12s;
}

#attackBtn.dragging {
  transform: scale(1.08);
  box-shadow: 0 4px 25px rgba(255,120,180,.8), 0 0 40px rgba(214,79,160,.6);
}

#attackBtn .hint {
  position: absolute;
  bottom: -26px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: #fff;
  opacity: .9;
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: .5px;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}

/* ---------- Placas dos personagens ---------- */
#worldUI {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.plate {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
}

.plate .pname {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
  margin-bottom: 2px;
  box-shadow: 0 2px 4px rgba(0,0,0,.15);
}

.plate .pbar {
  width: 80px;
  height: 9px;
  background: #3A1530;
  border: 2px solid #fff;
  border-radius: 5px;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}

.plate .pbar > div {
  height: 100%;
  background: linear-gradient(180deg, #FFB6D5, #FF4AA5);
  transition: width .15s;
}

.plate .php {
  position: absolute;
  inset: 0;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  line-height: 9px;
  text-shadow: 0 1px 2px #000;
}

/* ---------- Números de dano ---------- */
.dmg {
  position: absolute;
  color: #fff;
  font-size: 30px;
  font-weight: 900;
  text-shadow: 0 0 3px #8A2C63, 3px 3px 0 #8A2C63, -3px -3px 0 #8A2C63,
               3px -3px 0 #8A2C63, -3px 3px 0 #8A2C63;
  pointer-events: none;
  animation: dmgFloat .9s ease-out forwards;
  transform: translate(-50%, -50%);
}

@keyframes dmgFloat {
  0%   { transform: translate(-50%, -50%) scale(.5);   opacity: 0; }
  20%  { transform: translate(-50%, -50%) scale(1.3);  opacity: 1; }
  100% { transform: translate(-50%, -160%) scale(1);   opacity: 0; }
}

/* ---------- Tela de fim de jogo ---------- */
#gameover {
  position: absolute;
  inset: 0;
  background: rgba(60,20,50,.8);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 38px;
  text-align: center;
  pointer-events: auto;
  text-shadow: 0 3px 6px rgba(0,0,0,.5);
}

#gameover small {
  font-size: 16px;
  font-weight: 600;
  opacity: .85;
  margin-top: 12px;
}

#gameover button {
  margin-top: 24px;
  padding: 14px 32px;
  border-radius: 14px;
  background: linear-gradient(135deg, #FF8AC7, #D64FA0);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  border: 3px solid #fff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
  }
