@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@keyframes pop-in {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

body {
  background: #0b0b0f;
  color: #e8e8e8;
  font-family: "Courier New", monospace;
  text-align: center;
  margin: 0;
  padding: clamp(8px, 4vw, 24px);
  background-image: radial-gradient(circle at 50% 0%, #1a1330 0%, #0b0b0f 70%);
}

h1 {
  position: relative;
  z-index: 1;
  font-family: "Bungee", "Courier New", monospace;
  font-size: clamp(28px, 8vw, 64px);
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  color: #3ddc3d;
  text-shadow: 0 0 8px #3ddc3d99, 0 0 24px #3ddc3d66, 0 0 48px #3ddc3d33;
}

#setup {
  position: relative;
}

#setup-bg {
  /* Fixed to the viewport, not #setup's own box, so it reads as a full-page
     backdrop behind the title/progress-bar/form together, not a video
     confined to one card. Lives inside #setup purely so it hides for free
     when #setup gets .hidden at fight start - display:none on an ancestor
     still hides a position:fixed descendant. */
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: 0;
  /* Desaturate/darken at the source too, not just the overlay, so it reads
     as part of this site's dark palette instead of a bright video dropped
     on top of it. */
  filter: brightness(0.55) saturate(0.85);
}

#setup-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
  background: linear-gradient(180deg, #0b0b0fcc 0%, #0b0b0f99 40%, #0b0b0fcc 100%);
  border-radius: 4px;
}

.setup-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px 4px;
}

#setup input {
  width: 70px;
  margin: 0 8px;
  background: #1a1a22;
  color: #fff;
  border: 1px solid #444;
  padding: 4px;
  font-family: inherit;
}

#setup button {
  padding: 6px 18px;
  background: #3ddc3d;
  color: #0b0b0f;
  border: none;
  cursor: pointer;
  font-weight: bold;
  letter-spacing: 0.1em;
  box-shadow: 0 0 0 2px #0b0b0f, 0 0 12px #3ddc3d88;
  transition: transform 0.1s ease-out;
}

#setup button:hover {
  transform: scale(1.05);
}

#setup button:disabled {
  background: #444;
  box-shadow: none;
  cursor: default;
  transform: none;
}

.hidden {
  display: none !important;
}

#arena {
  max-width: 800px;
  margin: 16px auto;
  position: relative;
}

.hud {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.healthbar,
.powerbar {
  height: 16px;
  background: #161620;
  border: 2px solid #555;
  box-shadow: inset 0 0 0 1px #000;
}

.powerbar {
  height: 8px;
}

.health-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(#5cf25c, #2fae2f);
  transition: width 0.15s ease-out;
}

.power-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(#ffe066, #d9a300);
  transition: width 0.1s linear;
}

.power-fill.power-ready {
  animation: pulse 0.5s infinite;
  box-shadow: 0 0 8px #ffd700, 0 0 16px #ffd700aa;
}

#p1-health,
#p1-power {
  margin-left: auto;
}

#timer {
  width: 44px;
  font-size: 22px;
  color: #ffe066;
  text-shadow: 0 0 6px #ffe06699;
}

.names {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 2px 8px;
  font-size: 12px;
  opacity: 0.85;
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}

#round-info {
  font-size: 11px;
  color: #ffe066;
  opacity: 0.9;
  letter-spacing: 0.1em;
}

#canvas-wrap {
  position: relative;
}

canvas {
  background: #1b1330;
  border: 2px solid #444;
  box-shadow: 0 0 0 4px #0b0b0f, 0 0 24px #3ddc3d22;
  image-rendering: pixelated;
  width: 100%;
  max-width: 800px;
  aspect-ratio: 800 / 360;
  display: block;
}

/* Positioned relative to #canvas-wrap, which matches the canvas's own
   bounds exactly - percentages here line up with the 800x360 game-world
   coordinates fighters are drawn in, so this tracks their head height
   instead of floating relative to the whole arena (HUD included). */
.taunt {
  position: absolute;
  top: 34%;
  background: #fff;
  color: #000;
  padding: 6px 10px;
  border-radius: 6px;
  max-width: 190px;
  font-size: 12px;
  box-shadow: 0 2px 10px #0008;
}

#taunt-p1 {
  left: 10%;
}

#taunt-p2 {
  right: 10%;
}

#countdown {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  font-weight: bold;
  color: #ffe066;
  text-shadow: 0 0 12px #ffe066cc, 0 0 30px #ffe06666;
  animation: pop-in 0.25s ease-out;
}

#result {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  padding: 12px 28px;
  border: 2px solid #ffe066;
  box-shadow: 0 0 20px #ffe06666;
  animation: pop-in 0.35s ease-out;
  max-width: 420px;
  text-align: center;
}

#result-title {
  font-size: 32px;
  letter-spacing: 0.1em;
}

#result-quote {
  font-size: 13px;
  font-style: italic;
  opacity: 0.75;
  margin-top: 8px;
  letter-spacing: normal;
}

.controls {
  font-size: 11px;
  opacity: 0.6;
  margin-top: 8px;
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  45% { opacity: 0.75; }
  50% { opacity: 1; }
  75% { opacity: 0.85; }
}

@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}

.global-progress {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto 20px;
  padding: 12px 16px;
  background: #12121a;
  border: 1px solid #333;
  box-shadow: 0 0 0 1px #000, 0 0 20px #3ddc3d22;
  border-radius: 4px;
  text-align: left;
  font-size: 12px;
}

.progress-row {
  margin-bottom: 10px;
}

.progress-label {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 2px 8px;
  margin-bottom: 4px;
}

.progress-title {
  color: #3ddc3d;
  letter-spacing: 0.15em;
  font-weight: bold;
  text-shadow: 0 0 6px #3ddc3d99;
}

.progress-count {
  color: #fff;
  font-weight: bold;
}

.progress-dim {
  color: #888;
  font-weight: normal;
}

.progress-track {
  height: 10px;
  background: #1a1a22;
  border: 1px solid #444;
  box-shadow: inset 0 0 0 1px #000;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2fae2f, #5cf25c, #2fae2f);
  background-size: 200px 100%;
  animation: shimmer 3s linear infinite;
  box-shadow: 0 0 10px #5cf25caa;
  transition: width 0.3s ease-out;
}

.progress-flex {
  margin-top: 4px;
  font-size: 10px;
  color: #666;
  letter-spacing: 0.03em;
}

.burn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding-top: 8px;
  border-top: 1px solid #2a2a33;
}

.burn-flame {
  animation: flicker 1.4s infinite;
  filter: drop-shadow(0 0 4px #ff6b1a);
}

.burn-label {
  color: #ff9d4d;
  letter-spacing: 0.15em;
  font-weight: bold;
  font-size: 11px;
  text-shadow: 0 0 6px #ff6b1a99;
}

.burn-count {
  color: #fff;
  font-weight: bold;
  text-shadow: 0 0 8px #ff6b1a66;
}

.burn-pct {
  color: #ff9d4d;
  font-size: 11px;
  margin-left: auto;
}
