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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a0a;
  font-family: 'Arial Black', 'Arial', sans-serif;
  color: #fff;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hidden { display: none !important; }

/* ===================== HUD ===================== */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
}

#hud-top {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  padding: 10px 10px 0;
  gap: 8px;
}

.hud-box {
  background: rgba(10, 10, 10, 0.78);
  border: 2px solid #d62828;
  border-radius: 10px;
  padding: 6px 10px;
  text-align: center;
  flex: 1;
  backdrop-filter: blur(2px);
}

.hud-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: #ff4b4b;
}

.hud-box > div:last-child, .hud-box > span {
  font-size: 22px;
  font-weight: 900;
  color: #fff;
}

#hud-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#item-slots {
  display: flex;
  gap: 8px;
}

.item-slot {
  width: 44px;
  height: 44px;
  background: rgba(10, 10, 10, 0.78);
  border: 2px solid #555;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 20px;
  transition: transform 0.15s, border-color 0.15s;
}

.item-slot.filled { border-color: #ffd600; }
.item-slot.flash { animation: itemflash 0.3s; border-color: #ff4b4b; }

.item-ico { font-size: 11px; font-weight: 900; letter-spacing: 0; }
@keyframes itemflash {
  0% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

.item-num {
  position: absolute;
  top: -7px;
  right: -7px;
  background: #d62828;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  border-radius: 50%;
  width: 17px;
  height: 17px;
  display: none;
  align-items: center;
  justify-content: center;
}

.item-slot.filled .item-num { display: flex; }

#item-hint {
  font-size: 10px;
  letter-spacing: 2px;
  color: #aaa;
  background: rgba(10, 10, 10, 0.7);
  padding: 4px 12px;
  border-radius: 20px;
}

#effect-banner {
  position: absolute;
  top: 88px;
  left: 50%;
  transform: translateX(-50%);
  background: #d62828;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 8px 20px;
  border-radius: 30px;
  box-shadow: 0 4px 16px rgba(214, 40, 40, 0.5);
  animation: bannerIn 0.3s;
}

@keyframes bannerIn {
  from { transform: translateX(-50%) scale(0.6); opacity: 0; }
  to { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ===================== Telas ===================== */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  background: rgba(8, 8, 8, 0.72);
}

#char-screen, #gameover {
  background: rgba(10, 10, 10, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Brilhos vermelhos animados do menu */
.menu-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(60px);
  opacity: 0.55;
  z-index: 0;
}

.menu-glow.g1 {
  width: 46vmax; height: 46vmax;
  top: -18vmax; left: -14vmax;
  background: radial-gradient(circle, rgba(214, 40, 40, 0.85), transparent 65%);
  animation: glowDrift1 9s ease-in-out infinite alternate;
}

.menu-glow.g2 {
  width: 40vmax; height: 40vmax;
  bottom: -16vmax; right: -14vmax;
  background: radial-gradient(circle, rgba(190, 22, 22, 0.8), transparent 65%);
  animation: glowDrift2 11s ease-in-out infinite alternate;
}

.menu-glow.g3 {
  width: 22vmax; height: 22vmax;
  top: 52%; left: 50%;
  background: radial-gradient(circle, rgba(255, 90, 90, 0.6), transparent 60%);
  animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowDrift1 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(9vmax, 7vmax) scale(1.25); }
}

@keyframes glowDrift2 {
  from { transform: translate(0, 0) scale(1.1); }
  to { transform: translate(-8vmax, -6vmax) scale(0.9); }
}

@keyframes glowPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.35; }
  50% { transform: translate(-50%, -50%) scale(1.35); opacity: 0.7; }
}

/* Partículas flutuantes */
.menu-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.particle {
  position: absolute;
  bottom: -12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff4b4b;
  box-shadow: 0 0 8px #ff4b4b, 0 0 16px rgba(214, 40, 40, 0.6);
  opacity: 0;
  animation-name: particleRise;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes particleRise {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  12% { opacity: 0.85; }
  85% { opacity: 0.5; }
  100% { transform: translateY(-108vh) translateX(30px); opacity: 0; }
}

.menu-frame {
  position: relative;
  width: min(430px, 94vw);
  max-height: 95vh;
  overflow-y: auto;
  text-align: center;
  color: #fff;
  padding: 18px 20px;
  z-index: 2;
}

/* Logo */
.logo-big {
  font-size: clamp(42px, 12vw, 66px);
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff;
  line-height: 1;
  filter: drop-shadow(0 6px 18px rgba(214, 40, 40, 0.45));
}

.lg {
  display: inline-block;
  opacity: 0;
  animation: letterIn 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards;
  transform-origin: 50% 100%;
}

.lg1 { animation-delay: 0.05s; }
.lg2 { animation-delay: 0.12s; }
.lg3 { animation-delay: 0.19s; }
.lg4 { animation-delay: 0.26s; }
.lg-dot { color: #d62828; animation: dotIn 0.4s 0.33s forwards; opacity: 0; display: inline-block; text-shadow: 0 0 14px rgba(214, 40, 40, 0.9); }
.lg5 { animation-delay: 0.4s; }
.lg6 { animation-delay: 0.47s; }
.lg7 { animation-delay: 0.54s; }
.lg8 { animation-delay: 0.61s; }
.lg9 { animation-delay: 0.68s; }

.lgf { color: #d62828; text-shadow: 0 0 12px rgba(214, 40, 40, 0.85); }

@keyframes letterIn {
  from { opacity: 0; transform: translateY(34px) scale(0.7); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes dotIn {
  from { opacity: 0; transform: scale(0); }
  to { opacity: 1; transform: scale(1); }
}

.logo-slash {
  width: 74px;
  height: 5px;
  margin: 10px auto 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, transparent, #d62828, #ff4b4b, transparent);
  box-shadow: 0 0 14px rgba(214, 40, 40, 0.9);
  animation: slashIn 0.6s 0.85s ease-out backwards, slashGlow 2.2s 1s ease-in-out infinite;
}

@keyframes slashIn {
  from { transform: scaleX(0); opacity: 0; }
  to { transform: scaleX(1); opacity: 1; }
}

@keyframes slashGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(214, 40, 40, 0.7); }
  50% { box-shadow: 0 0 22px rgba(255, 80, 80, 1); }
}

.logo-sub {
  font-size: 12px;
  letter-spacing: 9px;
  color: #ddd;
  margin-top: 4px;
  opacity: 0;
  animation: fadeUp 0.7s 1s ease-out forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.menu-char-preview {
  position: relative;
  width: 148px;
  height: 148px;
  margin: 14px auto 10px;
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 38%, rgba(214, 40, 40, 0.22), rgba(10, 10, 10, 0.55) 70%);
  border: 2px solid rgba(214, 40, 40, 0.6);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 26px rgba(214, 40, 40, 0.45),
    inset 0 0 30px rgba(0, 0, 0, 0.6);
  animation: charFloat 3.2s ease-in-out infinite;
}

@keyframes charFloat {
  0%, 100% { transform: translateY(0) rotate(-1.2deg); }
  50% { transform: translateY(-9px) rotate(1.2deg); }
}

.menu-char-preview::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 26px;
  border: 2px dashed rgba(255, 90, 90, 0.5);
  animation: ringSpin 14s linear infinite;
  pointer-events: none;
}

@keyframes ringSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.menu-char-preview img {
  width: 104px;
  height: 104px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.7));
  animation: charBob 2.4s ease-in-out infinite;
}

@keyframes charBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.menu-record {
  margin: 4px auto 14px;
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  background: rgba(214, 40, 40, 0.12);
  border: 1px solid rgba(214, 40, 40, 0.55);
  border-radius: 30px;
  padding: 7px 18px;
  box-shadow: 0 0 14px rgba(214, 40, 40, 0.25);
  opacity: 0;
  animation: fadeUp 0.6s 1.15s ease-out forwards;
}

.m-record-label { font-size: 10px; letter-spacing: 2px; color: #e8b4b4; }
.m-record-value { font-size: 24px; font-weight: 900; color: #ff5b5b; text-shadow: 0 0 12px rgba(255, 75, 75, 0.7); }

/* Botões */
.btn {
  display: block;
  width: 100%;
  margin: 8px 0;
  padding: 15px;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 2px;
  font-family: inherit;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.08s, filter 0.1s, box-shadow 0.1s;
  position: relative;
  overflow: hidden;
}

.btn:active { transform: scale(0.97); }

.btn-red {
  color: #fff;
  background: linear-gradient(180deg, #ef3b3b, #b10f0f);
  box-shadow: 0 6px 0 #7a0808, 0 0 30px rgba(214, 40, 40, 0.55);
  animation: btnPulse 1.8s ease-in-out infinite;
}

.btn-red:active { box-shadow: 0 2px 0 #7a0808; transform: translateY(4px) scale(0.97); }

@keyframes btnPulse {
  0%, 100% { box-shadow: 0 6px 0 #7a0808, 0 0 18px rgba(214, 40, 40, 0.4); }
  50% { box-shadow: 0 6px 0 #7a0808, 0 0 40px rgba(255, 75, 75, 0.85); }
}

.btn-red::after {
  content: '';
  position: absolute;
  top: 0; left: -60%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  animation: shine 2.8s ease-in-out infinite;
}

@keyframes shine {
  0%, 55% { left: -60%; }
  85%, 100% { left: 130%; }
}

.btn-big {
  font-size: 22px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  opacity: 0;
  animation: fadeUp 0.6s 1.3s ease-out forwards;
}

.btn-arrow {
  font-size: 15px;
  animation: arrowNudge 1s ease-in-out infinite;
}

@keyframes arrowNudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(6px); }
}

.btn-dark {
  color: #fff;
  background: rgba(20, 20, 20, 0.85);
  border: 2px solid #d62828;
  box-shadow: 0 4px 0 #000;
  opacity: 0;
  animation: fadeUp 0.6s 1.5s ease-out forwards;
}

.btn-dark:hover { background: #2a0a0a; }

.menu-hint {
  font-size: 10px;
  color: #b99;
  margin-top: 10px;
  letter-spacing: 1px;
  line-height: 1.6;
  opacity: 0;
  animation: fadeUp 0.6s 1.7s ease-out forwards;
}

.fatal-msg {
  margin: 10px auto;
  padding: 10px 14px;
  background: rgba(150, 20, 20, 0.25);
  border: 1px solid #ff4b4b;
  border-radius: 10px;
  font-size: 12px;
  color: #ffb4b4;
  word-break: break-word;
}

/* ===================== Personagens ===================== */
.screen-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 3px 3px 0 #d62828;
  margin-bottom: 12px;
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.char-card {
  background: #161616;
  border: 3px solid #333;
  border-radius: 14px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  position: relative;
}

.char-card.selected { border-color: #d62828; box-shadow: 0 0 18px rgba(214, 40, 40, 0.35); }
.char-card.locked { opacity: 0.55; }
.char-card:active { transform: scale(0.97); }

.char-thumb {
  width: 90px;
  height: 90px;
  margin: 0 auto 6px;
  background: #0a0a0a;
  border-radius: 10px;
  overflow: hidden;
}

.char-thumb canvas { width: 100%; height: 100%; }

.char-name { font-size: 14px; font-weight: 900; color: #fff; }
.char-desc { font-size: 9px; color: #aaa; margin-top: 2px; }
.char-lock { font-size: 10px; color: #ff4b4b; font-weight: 700; margin-top: 4px; letter-spacing: 1px; }

.unlock-progress {
  margin: 14px 0 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px 14px;
}

.up-label { font-size: 10px; letter-spacing: 2px; color: #aaa; }
.up-bar {
  height: 12px;
  background: #222;
  border-radius: 8px;
  margin: 8px 0 4px;
  overflow: hidden;
}

.up-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #d62828, #ff6b6b);
  border-radius: 8px;
  transition: width 0.4s;
}

.up-text { font-size: 11px; color: #ff4b4b; font-weight: 700; }

/* ===================== Fim de jogo ===================== */
.go-title {
  font-size: 36px;
  font-weight: 900;
  color: #fff;
  text-shadow: 4px 4px 0 #d62828;
}

.new-record {
  display: inline-block;
  margin: 8px auto;
  padding: 6px 18px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  background: #d62828;
  border-radius: 30px;
  animation: pulse 0.7s infinite alternate;
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.12); }
}

.go-score-wrap { margin: 12px 0; }
.go-label { font-size: 12px; letter-spacing: 4px; color: #ff4b4b; }
.go-value { font-size: 54px; font-weight: 900; color: #fff; text-shadow: 3px 3px 0 #d62828; }

.go-stats { display: flex; justify-content: space-around; margin: 12px 0; gap: 8px; }

.go-stat {
  background: #161616;
  border: 2px solid #333;
  border-radius: 12px;
  padding: 8px 6px;
  flex: 1;
}

.gs-label { display: block; font-size: 9px; letter-spacing: 1px; color: #aaa; }
.gs-value { display: block; font-size: 17px; font-weight: 800; color: #ff4b4b; margin-top: 2px; }

.unlock-toast {
  margin: 8px auto;
  padding: 8px 14px;
  background: linear-gradient(90deg, #d62828, #ff6b6b);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
  animation: pulse 0.7s infinite alternate;
}

#touch-zone {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: none;
}

#touch-zone.active { display: block; }

@media (max-width: 400px) {
  .char-thumb { width: 74px; height: 74px; }
  .go-value { font-size: 44px; }
}
