/* WASD Dodge styles */

:root {
  --preview-arena-bg: rgba(0,0,0,0.1);
  --canvas-bg: rgba(255, 255, 255, 0.02);
  --canvas-border: var(--color-outline, rgba(255, 255, 255, 0.12));
  --canvas-shadow: rgba(0, 0, 0, 0.3);
  --overlay-bg: rgba(10, 15, 25, 0.85);
  --container-bg: var(--color-surface, rgba(0, 0, 0, 0.2));
  --container-border: var(--card-border, var(--color-outline, rgba(255, 255, 255, 0.08)));
}

html.light {
  --preview-arena-bg: rgba(15, 23, 42, 0.05);
  --canvas-bg: rgba(15, 23, 42, 0.02);
  --canvas-border: rgba(15, 23, 42, 0.15);
  --canvas-shadow: rgba(15, 23, 42, 0.1);
  --overlay-bg: rgba(255, 255, 255, 0.93);
  --container-bg: rgba(15, 23, 42, 0.02);
  --container-border: rgba(15, 23, 42, 0.08);
}

.dodge-game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 24px;
  margin-bottom: 12px;
  max-width: 960px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.dodge-hud-item {
  display: flex;
  flex-direction: column;
}

.dodge-hud-lbl {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dodge-hud-val {
  font-family: var(--font-h, sans-serif);
  font-size: 20px;
  font-weight: 800;
  color: #818cf8;
  margin-top: 2px;
}

.dodge-hud-val.text-blue {
  color: #818cf8;
}

.dodge-audio-box {
  display: flex;
  align-items: center;
}

.dodge-sound-btn {
  background: var(--color-surface, rgba(0, 0, 0, 0.2));
  border: 1px solid var(--color-outline, rgba(255, 255, 255, 0.08));
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.dodge-sound-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  transform: scale(1.05);
}

/* Canvas arena */
.dodge-canvas-container {
  position: relative;
  width: 100% !important;
  min-height: 480px;
  margin: 20px 0 !important;
  background: var(--container-bg);
  border-top: 1.5px solid var(--container-border) !important;
  border-bottom: 1.5px solid var(--container-border) !important;
  border-left: none !important;
  border-right: none !important;
  border-radius: 0 !important;
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

#dodgeCanvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 400px;
  max-height: 400px;
  box-sizing: border-box;
  background: var(--canvas-bg);
  border: 2px solid var(--canvas-border);
  border-radius: 8px;
  box-shadow: 0 8px 32px var(--canvas-shadow);
}

.dodge-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: var(--overlay-bg);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.dodge-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.dodge-overlay-inner {
  text-align: center;
  animation: pulse 2.5s infinite ease-in-out;
}

.dodge-instruction {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
}

/* Preview Arena in Intro */
.dodge-preview-arena {
  width: 140px;
  height: 140px;
  margin: 20px auto 10px;
  border: 1px dashed var(--container-border);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  background: var(--preview-arena-bg);
}

.dodge-preview-player {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #818cf8;
  border-radius: 4px;
  left: 62px;
  top: 62px;
  box-shadow: 0 0 8px rgba(129, 140, 248, 0.5);
  animation: dodge-player-loop 4.5s linear infinite;
}

.dodge-preview-enemy {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #ef4444;
  border-radius: 3px;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.dodge-preview-enemy.enemy-1 {
  left: -20px;
  top: 45px;
  animation: dodge-enemy1-loop 4.5s linear infinite;
}

.dodge-preview-enemy.enemy-2 {
  left: 140px;
  top: 85px;
  animation: dodge-enemy2-loop 4.5s linear infinite;
}

/* Keyframe animations mapping HSL parameter variables */
@keyframes dodge-player-loop {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(0, -25px); }
  50% { transform: translate(0, 25px); }
  75% { transform: translate(-20px, 0); }
}

@keyframes dodge-enemy1-loop {
  0% { left: -20px; }
  100% { left: 160px; }
}

@keyframes dodge-enemy2-loop {
  0% { left: 160px; }
  100% { left: -20px; }
}

.dodge-preview-caption {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
}

/* D-pad Styling */
.dodge-dpad {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 16px auto 0;
  width: max-content;
}

.dpad-row {
  display: flex;
  justify-content: center;
  gap: 32px;
  align-items: center;
}

.dpad-spacer {
  width: 54px;
  height: 54px;
}

.dpad-btn {
  width: 54px;
  height: 54px;
  background: var(--key-bg, rgba(255, 255, 255, 0.05));
  border: 2px solid var(--key-border, rgba(255, 255, 255, 0.1));
  border-radius: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  box-shadow: 0 3px 0 var(--key-shadow, rgba(255, 255, 255, 0.15));
  transition: transform 0.05s, box-shadow 0.05s;
}

.dpad-btn.pressed, .dpad-btn:active {
  transform: translateY(3px) !important;
  box-shadow: 0 0 0 transparent !important;
  background: rgba(108, 99, 255, 0.2) !important;
  border-color: #6c63ff !important;
}

.dpad-btn span {
  font-size: 28px;
  pointer-events: none;
}

@media (max-width: 768px) {
  .dodge-dpad {
    display: flex;
  }
}
