/* Core Reset & Variables */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

:root {
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-pixel: 'Press Start 2P', monospace;
  --color-accent: #ff007f;
  --color-cyan: #00f0ff;
  --color-yellow: #ffee00;
  --color-bg: #070410;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-main);
  background: radial-gradient(circle at center, #14092b 0%, var(--color-bg) 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
}

/* Top Wrapper & Tab Navigation */
.hud-top-wrapper {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 92vw;
  max-width: 900px;
}

.tab-bar {
  display: flex;
  gap: 8px;
  background: rgba(15, 10, 30, 0.8);
  backdrop-filter: blur(16px);
  padding: 6px 14px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  overflow-x: auto;
  max-width: 100%;
}

.tab-btn {
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(255, 0, 127, 0.3) 0%, rgba(0, 240, 255, 0.3) 100%);
  color: var(--color-cyan);
  border-color: var(--color-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

/* Fighting HUD Header */
.hud-fight-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: rgba(15, 10, 30, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 25px rgba(255, 0, 127, 0.25);
  width: 100%;
  justify-content: space-between;
}

.fighter-card {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.left-fighter {
  flex-direction: row;
}

.right-fighter {
  flex-direction: row-reverse;
  text-align: right;
}

.fighter-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}

.fighter-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.fighter-name {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: #ffffff;
  letter-spacing: 1px;
}

.hp-bar-container {
  width: 100%;
  height: 14px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff0055, #ffcc00, #33cc33);
  transition: width 0.2s ease-out;
  box-shadow: 0 0 10px rgba(51, 204, 51, 0.8);
}

.hp-text {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--color-cyan);
}

.vs-container {
  padding: 0 8px;
}

.vs-badge {
  font-family: var(--font-pixel);
  font-size: 1rem;
  background: linear-gradient(135deg, #ff007f 0%, #ffee00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 10px rgba(255, 0, 127, 0.8);
  animation: vsPulse 1.5s ease-in-out infinite alternate;
}

@keyframes vsPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.12); }
}

/* Arena Viewport */
#arena-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100vw;
  height: 100vh;
}

#arena {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-canvas {
  display: block;
  border-radius: 16px;
}

/* Footer Control Panel */
.hud-footer {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  max-width: 95vw;
}

.control-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(15, 10, 30, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  flex-wrap: wrap;
  justify-content: center;
}

.group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.group label {
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.5px;
}

.select-input {
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
}

.select-input option {
  background: #150a2a;
  color: #fff;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 70px;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  box-shadow: 0 0 8px var(--color-accent);
}

.uploader-group {
  display: flex;
  flex-direction: row;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-file {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.btn-file input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.action-group {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
}

/* Buttons */
.btn {
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:hover {
  transform: translateY(-2deg) scale(1.04);
}

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

.btn-primary {
  background: linear-gradient(135deg, #ff007f 0%, #7928ca 100%);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.5);
}

.glow-btn {
  animation: glowPulse 2s infinite alternate;
}

@keyframes glowPulse {
  0% { box-shadow: 0 0 10px rgba(255, 0, 127, 0.5); }
  100% { box-shadow: 0 0 25px rgba(0, 240, 255, 0.9), 0 0 15px rgba(255, 0, 127, 0.8); }
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(255, 50, 50, 0.25);
  color: #ff6b6b;
  border: 1px solid rgba(255, 50, 50, 0.4);
}

.btn-lg {
  font-size: 1rem;
  padding: 14px 28px;
  border-radius: 30px;
}

/* Overlay Card */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(9, 5, 20, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-card {
  background: rgba(20, 12, 40, 0.95);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(255, 0, 127, 0.3);
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.overlay-card h1 {
  font-size: 2rem;
  font-weight: 900;
}

.rainbow-text {
  background: linear-gradient(90deg, #ff0055, #ff5500, #ffcc00, #33cc33, #0099ff, #9933ff, #ff0055);
  background-size: 200% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: rainbowShift 3s linear infinite;
}

@keyframes rainbowShift {
  to { background-position: 200% center; }
}

@media (max-width: 768px) {
  .hud-top-wrapper {
    top: 8px;
    gap: 6px;
  }
  .hud-fight-bar {
    padding: 6px 10px;
  }
  .fighter-avatar {
    width: 32px;
    height: 32px;
  }
  .hud-footer {
    bottom: 8px;
  }
  .control-panel {
    padding: 6px 8px;
    gap: 4px;
  }
}
