/* ============================================
   GESTURE DUELING — Minimal Dark UI
   ============================================ */

:root {
  --bg: #0a0a0f;
  --bg-card: #111118;
  --border: #1e1e2a;
  --text: #e8e8ed;
  --text-dim: #555566;
  --fire: #ff6b35;
  --shield: #4a9eff;
  --lightning: #c77dff;
  --heal: #50fa7b;
  --wizard-hp: #8b5cf6;
  --wizard-hp-dark: #5b21b6;
  --player-hp: #f0a030;
  --player-hp-dark: #c47a10;
  --amber: #f0a030;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Press Start 2P', monospace;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ============================================
   SCREENS
   ============================================ */

.screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
}

.screen.active { display: flex; }

/* ============================================
   BUTTONS
   ============================================ */

.pixel-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  padding: 14px 28px;
  background: #fff;
  color: #000;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: transform 0.1s, opacity 0.1s;
}

.pixel-btn:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

.pixel-btn:active {
  transform: translateY(1px);
}

.pixel-btn:disabled {
  background: #333;
  color: #666;
  cursor: not-allowed;
}

.pixel-btn-secondary {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.pixel-btn-secondary:hover {
  color: var(--text);
  border-color: #444;
}

/* ============================================
   TITLE SCREEN
   ============================================ */

.title-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.title-content .pixel-btn {
  width: 260px;
}

.game-title {
  font-size: 44px;
  line-height: 1.4;
  color: #fff;
  letter-spacing: 4px;
}

.subtitle {
  font-size: 9px;
  color: var(--text-dim);
  line-height: 1.8;
  letter-spacing: 1px;
}

/* ============================================
   HOW TO PLAY
   ============================================ */

.howto-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 550px;
}

.howto-content h2 {
  font-size: 20px;
  color: #fff;
  letter-spacing: 3px;
}

.spell-guide {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.spell-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.spell-gesture {
  font-size: 24px;
  width: 36px;
  text-align: center;
  font-family: sans-serif;
}

.spell-name {
  font-size: 11px;
  width: 90px;
}

.spell-name.fire { color: var(--fire); }
.spell-name.shield { color: var(--shield); }
.spell-name.lightning { color: var(--lightning); }
.spell-name.heal { color: var(--heal); }

.spell-desc {
  font-size: 8px;
  color: var(--text-dim);
  flex: 1;
}

.howto-rules {
  font-size: 8px;
  color: var(--text-dim);
  line-height: 2.4;
}

/* ============================================
   CALIBRATION
   ============================================ */

.calibrate-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.calibrate-content h2 {
  font-size: 18px;
  color: #fff;
  letter-spacing: 3px;
}

.calibrate-sub {
  font-size: 9px;
  color: var(--text-dim);
}

.calibrate-video-wrap {
  position: relative;
  width: 480px;
  height: 360px;
  border: 1px solid var(--border);
  background: #000;
  overflow: hidden;
}

.calibrate-video-wrap video,
.calibrate-video-wrap canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transform: scaleX(-1);
}

.calibrate-status {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-dim);
  background: rgba(10, 10, 15, 0.85);
  padding: 8px 16px;
  z-index: 2;
}

.calibrate-status.detected {
  color: var(--heal);
}

.debug-info {
  font-family: monospace;
  font-size: 10px;
  color: var(--amber);
  background: rgba(0,0,0,0.8);
  padding: 6px 12px;
  min-height: 22px;
  white-space: nowrap;
}

/* ============================================
   BATTLE SCREEN
   ============================================ */

#screen-battle {
  flex-direction: column;
  padding: 20px 40px;
  gap: 0;
}

/* ---- HUD ---- */
.battle-hud {
  display: flex;
  justify-content: space-between;
  width: 100%;
  z-index: 2;
  margin-bottom: 16px;
}

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

.wizard-info { align-items: flex-start; }
.player-info { align-items: flex-end; }

.fighter-name {
  font-size: 12px;
  letter-spacing: 3px;
}

.wizard-info .fighter-name { color: var(--wizard-hp); }
.player-info .fighter-name { color: var(--player-hp); }

.health-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.health-bar {
  width: 220px;
  height: 8px;
  background: #1a1a24;
  border-radius: 4px;
  overflow: hidden;
}

.health-fill {
  height: 100%;
  width: 100%;
  background: var(--wizard-hp);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.player-fill {
  background: var(--player-hp);
}

.health-text {
  font-size: 10px;
  color: var(--text-dim);
  min-width: 55px;
}

/* ---- ARENA ---- */
.battle-arena {
  flex: 1;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 24px;
  z-index: 2;
}

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

.wizard-canvas {
  width: 320px;
  height: 280px;
  background: none;
}

.webcam-wrap {
  position: relative;
  width: 320px;
  height: 280px;
  border: 1px solid var(--border);
  background: #000;
  overflow: hidden;
  border-radius: 12px;
}

.webcam-wrap video,
.webcam-wrap canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transform: scaleX(-1);
  object-fit: cover;
}

.spell-indicator {
  font-size: 12px;
  padding: 8px 16px;
  min-width: 130px;
  text-align: center;
  color: var(--text-dim);
  letter-spacing: 1px;
}

/* ---- CENTER ---- */
.battle-center {
  width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.round-counter {
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 3px;
}

.countdown {
  font-size: 64px;
  color: #fff;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 4px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.countdown.cast {
  font-size: 28px;
  color: var(--amber);
  animation: castPulse 0.4s ease-in-out infinite;
}

@keyframes castPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.clash-result {
  font-size: 9px;
  text-align: center;
  line-height: 2;
  min-height: 40px;
  color: var(--text-dim);
}

/* ---- FOOTER ---- */
.battle-footer {
  padding: 8px 0 0;
  width: 100%;
  position: relative;
  z-index: 2;
}

.spell-icons-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.spell-icon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 6px;
  background: linear-gradient(180deg, #1a1a2e 0%, #12121f 100%);
  border: 2px solid #2a2a44;
  border-radius: 4px;
}

.spell-icon-card:hover {
  border-color: #444466;
}

.heal-card {
  border-color: #1a3a2a;
}

.spell-icon-emoji {
  font-size: 32px;
  font-family: sans-serif;
}

.spell-icon-label {
  font-size: 7px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.pause-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  font-size: 7px;
  padding: 6px 12px;
  opacity: 0.3;
}

.pause-btn:hover { opacity: 1; }

/* ============================================
   GAME OVER
   ============================================ */

.gameover-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.gameover-content h2 {
  font-size: 36px;
  letter-spacing: 4px;
}

#gameover-title.win {
  color: #fff;
  animation: winPulse 1.5s ease-in-out infinite;
}

#gameover-title.lose {
  color: var(--text-dim);
}

@keyframes winPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

#gameover-subtitle {
  font-size: 9px;
  color: var(--text-dim);
}

.gameover-stats {
  font-size: 9px;
  color: var(--text-dim);
  line-height: 2.4;
}

/* ============================================
   EFFECTS OVERLAY
   ============================================ */

.effects-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 100;
}

/* ============================================
   SCREEN SHAKE
   ============================================ */

.screen-shake { animation: shake 0.3s ease-out; }

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-4px, 2px); }
  50% { transform: translate(4px, -2px); }
  75% { transform: translate(-2px, 4px); }
}
