* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background: #070b1a;
  color: #f8fafc;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hidden {
  display: none !important;
}

/* HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(10px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) 8px calc(14px + env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  z-index: 10;
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hud-left,
.hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  background: rgba(9, 13, 28, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 5px 11px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

#hudHearts {
  font-size: 15px;
  letter-spacing: 2px;
}

#hudScore {
  color: #fde047;
}

#hudDist {
  color: #38bdf8;
}

#hudCoins {
  color: #facc15;
}

.icon-btn {
  pointer-events: auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(9, 13, 28, 0.78);
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn:active {
  transform: scale(0.92);
}

.hud-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.combo-badge {
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff;
  font-weight: 900;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 2px solid #090d16;
  box-shadow: 0 2px 0 #090d16;
}

.power-bars {
  display: flex;
  gap: 6px;
}

.tag {
  font-size: 11px;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1.5px solid #090d16;
}

.tag.shield {
  background: #06b6d4;
  color: #082f49;
}

.tag.magnet {
  background: #c084fc;
  color: #2e1065;
}

.tag.turbo {
  background: #fb923c;
  color: #431407;
}

/* Boss Health Bar */
.boss-wrap {
  align-self: center;
  width: min(360px, 86vw);
  background: rgba(9, 13, 28, 0.82);
  border: 2px solid #f43f5e;
  border-radius: 12px;
  padding: 5px 10px;
}

.boss-name {
  font-size: 11px;
  font-weight: 900;
  color: #fda4af;
  text-align: center;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.boss-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.boss-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ef4444, #f97316);
  transition: width 0.12s ease-out;
}

/* Mobile Touch Controls Deck */
#controlsDeck {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px calc(14px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 12;
}

.ctrl-group {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}

.ctrl-btn {
  pointer-events: auto;
  touch-action: none;
  border: 3px solid rgba(255, 255, 255, 0.32);
  border-radius: 22px;
  color: #ffffff;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 7px 0 rgba(9, 13, 28, 0.85), 0 12px 24px rgba(0, 0, 0, 0.45);
  transition: transform 0.05s ease, box-shadow 0.05s ease, filter 0.05s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.ctrl-btn .ctrl-icon {
  font-size: 24px;
  line-height: 1;
}

.ctrl-btn .ctrl-label {
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.ctrl-btn.pressed,
.ctrl-btn:active {
  transform: translateY(5px) scale(0.96);
  box-shadow: 0 2px 0 rgba(9, 13, 28, 0.9), 0 4px 10px rgba(0, 0, 0, 0.35);
  filter: brightness(1.18);
}

.btn-slide {
  width: 74px;
  height: 74px;
  background: rgba(51, 65, 85, 0.82);
}

.btn-web {
  width: 80px;
  height: 80px;
  background: rgba(8, 145, 178, 0.85);
}

.btn-strike {
  width: 82px;
  height: 82px;
  background: rgba(234, 88, 12, 0.88);
}

.btn-jump {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: linear-gradient(155deg, #ef233c, #b91c1c);
  border-color: rgba(254, 240, 138, 0.65);
}

.btn-jump .ctrl-icon {
  font-size: 28px;
}

.btn-jump .ctrl-sub {
  font-size: 9px;
  opacity: 0.9;
  font-weight: 700;
}

@media (max-height: 500px) and (orientation: landscape) {
  .btn-slide { width: 66px; height: 66px; }
  .btn-web { width: 72px; height: 72px; }
  .btn-strike { width: 74px; height: 74px; }
  .btn-jump { width: 92px; height: 92px; }
}

/* Overlays & Modals */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.55), rgba(6, 10, 23, 0.88));
  z-index: 20;
}

.panel {
  width: min(440px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.92);
  border: 3px solid #38bdf8;
  border-radius: 24px;
  padding: 20px 18px;
  text-align: center;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.65);
}

.title-kicker {
  display: inline-block;
  background: #fde047;
  color: #090d16;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 1.4px;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.game-title {
  margin: 0;
  font-size: clamp(28px, 6vw, 40px);
  line-height: 1.02;
  font-weight: 900;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffffff 20%, #38bdf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 #090d16);
}

.subtitle {
  margin: 8px 0 14px;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.4;
}

.stats-strip {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.stat-box {
  background: rgba(30, 41, 59, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 8px 12px;
  min-width: 112px;
}

.stat-box small {
  display: block;
  font-size: 10px;
  color: #94a3b8;
  font-weight: 700;
  letter-spacing: 0.7px;
}

.stat-box strong {
  font-size: 15px;
  color: #fde047;
}

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.primary-btn {
  width: 100%;
  padding: 14px 18px;
  border-radius: 16px;
  border: 3px solid #090d16;
  background: linear-gradient(180deg, #ff3b57, #d90429);
  color: #ffffff;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.8px;
  box-shadow: 0 5px 0 #090d16;
  cursor: pointer;
}

.primary-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #090d16;
}

.secondary-btn {
  width: 100%;
  padding: 11px 14px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: rgba(30, 41, 59, 0.9);
  color: #f8fafc;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.secondary-btn:active {
  transform: scale(0.98);
}

.toggle-row {
  display: flex;
  gap: 8px;
}

.toggle-row .secondary-btn {
  font-size: 12px;
  padding: 9px 10px;
}

.tips-box {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: #cbd5e1;
  text-align: left;
  line-height: 1.5;
}

.best-banner {
  background: linear-gradient(90deg, #facc15, #f97316);
  color: #090d16;
  font-weight: 900;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
  display: inline-block;
}

/* Active Hero Quick Banner */
.hero-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 16px;
  background: rgba(30, 41, 59, 0.85);
  border: 2px solid rgba(56, 189, 248, 0.45);
  text-align: left;
}

.hero-banner canvas {
  width: 60px;
  height: 70px;
  border-radius: 12px;
  background: rgba(9, 13, 28, 0.7);
  flex-shrink: 0;
}

.hero-banner-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-banner-info small {
  font-size: 10px;
  color: #38bdf8;
  font-weight: 800;
  letter-spacing: 0.7px;
}

.hero-banner-info strong {
  font-size: 15px;
  color: #ffffff;
}

.hero-banner-info span {
  font-size: 11px;
  color: #cbd5e1;
}

.hero-switch-btn {
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid #090d16;
  background: #fde047;
  color: #090d16;
  font-weight: 900;
  font-size: 11px;
  cursor: pointer;
}

/* Hero Roster Modal */
.suit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 16px;
}

.suit-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(30, 41, 59, 0.88);
  border: 2px solid rgba(255, 255, 255, 0.12);
  text-align: left;
}

.suit-card.equipped {
  border-color: #fde047;
  background: rgba(30, 58, 138, 0.48);
}

.suit-preview-canvas {
  width: 64px;
  height: 74px;
  border-radius: 12px;
  background: rgba(9, 13, 28, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.suit-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.suit-info strong {
  font-size: 14px;
  color: #f8fafc;
}

.suit-info .role-tag {
  font-size: 10px;
  color: #fde047;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.suit-info span {
  font-size: 11px;
  color: #94a3b8;
}

.suit-action {
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid #090d16;
  background: #38bdf8;
  color: #082f49;
  font-weight: 900;
  font-size: 12px;
  cursor: pointer;
}

.suit-action:disabled {
  background: rgba(250, 204, 21, 0.22);
  color: #fde047;
  border-color: rgba(250, 204, 21, 0.45);
  cursor: default;
}
