/* ===== Combat Screen ===== */
#screen-combat {
  background: rgba(0, 0, 0, 0.85);
  justify-content: flex-end;
}

.combat-arena {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 20px;
  gap: 12px;
}

.combatant {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 500px;
}

.enemy-side {
  margin-bottom: auto;
  margin-top: 30px;
  flex-direction: row;
}

.player-side {
  margin-top: auto;
  margin-bottom: 8px;
  flex-direction: row-reverse;
}

.combatant-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.enemy-side .combatant-info {
  align-items: flex-start;
}

.player-side .combatant-info {
  align-items: flex-end;
}

.combatant-name {
  display: block;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 18px;
  margin-bottom: 6px;
}

.combat-hp-bar-container {
  width: 100%;
  max-width: 200px;
  height: 16px;
  background: var(--hp-bg);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.combat-hp-bar {
  height: 100%;
  background: var(--hp-color);
  transition: width 0.4s;
}

.combat-hp-bar.player-hp {
  background: #4CAF50;
}

.combat-hp-text {
  color: var(--text-dim);
  font-size: 13px;
}

.combat-mana-bar-container {
  width: 100%;
  max-width: 200px;
  height: 12px;
  background: rgba(66, 165, 245, 0.2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
  margin-top: 4px;
}

.combat-mana-bar {
  height: 100%;
  background: #42a5f5;
  transition: width 0.4s;
}

.combat-mana-text {
  color: #90caf9;
  font-size: 12px;
}

.combatant-sprite {
  width: 120px;
  height: 120px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.combatant-sprite canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Pet sprite next to player */
.pet-sprite {
  width: 60px;
  height: 60px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  animation: petBounce 1s ease-in-out infinite;
}

.pet-sprite:empty {
  display: none;
}

.pet-sprite canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5));
}

@keyframes petBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.combat-message {
  color: var(--text-primary);
  font-size: 16px;
  min-height: 24px;
  text-align: center;
  padding: 8px;
}

/* Enemy Intent Display - Make it VERY visible */
.enemy-intent-container {
  width: 100%;
  max-width: 400px;
  margin: 10px auto;
  text-align: center;
}

.enemy-intent-label {
  color: #ffeb3b;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 2px;
  margin-bottom: 6px;
  text-shadow: 0 0 10px rgba(255, 235, 59, 0.5);
}

.enemy-intent {
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  padding: 12px 24px;
  background: rgba(255, 152, 0, 0.25);
  border: 3px solid #ff9800;
  border-radius: 8px;
  animation: intentPulse 1s ease-in-out infinite, intentGlow 1s ease-in-out infinite;
  text-shadow: 0 0 10px currentColor;
}

.enemy-intent-container:has(.enemy-intent:empty) {
  display: none;
}

.enemy-intent:empty {
  display: none;
}

/* Color-coded by action type */
.enemy-intent.attack {
  color: #ff5252;
  background: rgba(244, 67, 54, 0.25);
  border-color: #f44336;
  box-shadow: 0 0 20px rgba(244, 67, 54, 0.4);
}
.enemy-intent.dodge {
  color: #64b5f6;
  background: rgba(33, 150, 243, 0.25);
  border-color: #2196f3;
  box-shadow: 0 0 20px rgba(33, 150, 243, 0.4);
}
.enemy-intent.block {
  color: #81c784;
  background: rgba(76, 175, 80, 0.25);
  border-color: #4caf50;
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.4);
}
.enemy-intent.counter {
  color: #ce93d8;
  background: rgba(156, 39, 176, 0.25);
  border-color: #9c27b0;
  box-shadow: 0 0 20px rgba(156, 39, 176, 0.4);
}
.enemy-intent.special {
  color: #f48fb1;
  background: rgba(233, 30, 99, 0.25);
  border-color: #e91e63;
  box-shadow: 0 0 20px rgba(233, 30, 99, 0.4);
}

@keyframes intentPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes intentGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.status-effects {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  min-height: 20px;
}

.enemy-side .status-effects {
  justify-content: flex-start;
}

.player-side .status-effects {
  justify-content: flex-end;
}

.status-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.5);
  color: var(--text-secondary);
  border: 1px solid var(--ui-border);
}

.status-badge.burn { border-color: #e53935; color: #ef9a9a; }
.status-badge.slow { border-color: #42a5f5; color: #90caf9; }
.status-badge.stun { border-color: #ffd54f; color: #fff9c4; }
.status-badge.sleep { border-color: #9575cd; color: #d1c4e9; }
.status-badge.defense_up { border-color: #4CAF50; color: #a5d6a7; }
.status-badge.weaken { border-color: #8d6e63; color: #bcaaa4; }

/* ===== Combat Actions ===== */
.combat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 24px;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  border-top: 1px solid var(--ui-border);
  width: 100%;
}

.action-btn {
  padding: 10px 18px;
  background: var(--ui-bg-solid);
  color: var(--text-primary);
  border: 2px solid var(--ui-border);
  border-radius: 4px;
  font-size: 14px;
  font-family: var(--font-display);
  min-width: 100px;
  transition: all 0.2s;
}

.action-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
}

.action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.action-btn.spell-btn {
  border-color: var(--mana-color);
}

.action-btn.item-btn {
  border-color: var(--coin-color);
}

/* ===== Combat Animations ===== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes damageFlash {
  0%, 100% { opacity: 1; }
  25%, 75% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-40px); }
}

.shake {
  animation: shake 0.4s ease-in-out;
}

.damage-flash {
  animation: damageFlash 0.4s ease-in-out;
}

.damage-number {
  position: absolute;
  color: var(--hp-color);
  font-size: 20px;
  font-weight: bold;
  animation: floatUp 0.8s ease-out forwards;
  pointer-events: none;
}

.damage-number.heal {
  color: var(--success);
}

.damage-number.miss {
  color: var(--text-dim);
  font-size: 16px;
}

/* ===== Phase Indicator ===== */
.phase-indicator {
  text-align: center;
  font-size: 22px;
  font-weight: bold;
  font-family: var(--font-display);
  padding: 12px 24px;
  margin: 8px auto;
  border-radius: 8px;
  letter-spacing: 2px;
  animation: phasePulse 1s ease-in-out infinite;
}

.phase-indicator.attack-phase {
  color: #4CAF50;
  background: rgba(76, 175, 80, 0.2);
  border: 2px solid #4CAF50;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.phase-indicator.defend-phase {
  color: #ff9800;
  background: rgba(255, 152, 0, 0.2);
  border: 2px solid #ff9800;
  text-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}

@keyframes phasePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.02); opacity: 0.9; }
}

/* Hidden class for button groups */
.combat-actions.hidden {
  display: none !important;
}

/* Style defend buttons differently */
.defend-actions .action-btn.block-btn {
  border-color: #4CAF50;
}

.defend-actions .action-btn.dodge-btn {
  border-color: #2196f3;
}

.defend-actions .action-btn.counter-btn {
  border-color: #9c27b0;
}

/* Defend Result Indicators */
.phase-indicator.result-block {
  color: #4CAF50;
  background: rgba(76, 175, 80, 0.3);
  border: 3px solid #4CAF50;
  text-shadow: 0 0 15px rgba(76, 175, 80, 0.8);
  animation: resultFlash 0.3s ease-out;
}

.phase-indicator.result-dodge {
  color: #2196f3;
  background: rgba(33, 150, 243, 0.3);
  border: 3px solid #2196f3;
  text-shadow: 0 0 15px rgba(33, 150, 243, 0.8);
  animation: resultFlash 0.3s ease-out;
}

.phase-indicator.result-counter {
  color: #9c27b0;
  background: rgba(156, 39, 176, 0.3);
  border: 3px solid #9c27b0;
  text-shadow: 0 0 15px rgba(156, 39, 176, 0.8);
  animation: resultFlash 0.3s ease-out;
}

.phase-indicator.result-hit {
  color: #f44336;
  background: rgba(244, 67, 54, 0.3);
  border: 3px solid #f44336;
  text-shadow: 0 0 15px rgba(244, 67, 54, 0.8);
  animation: resultFlash 0.3s ease-out;
}

@keyframes resultFlash {
  0% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ===== Mobile/Touch Combat Styles ===== */
@media (pointer: coarse) {
  .action-btn {
    min-width: 90px;
    min-height: 50px;
    padding: 14px 20px;
    font-size: 15px;
  }

  .action-btn:active {
    background: var(--accent);
    border-color: var(--accent-hover);
    transform: scale(0.95);
  }

  .combat-actions {
    gap: 10px;
    padding: 12px 16px;
  }

  .combatant-sprite {
    width: 80px;
    height: 80px;
  }

  .pet-sprite {
    width: 50px;
    height: 50px;
  }

  .enemy-intent {
    font-size: 18px;
    padding: 10px 16px;
  }

  .phase-indicator {
    font-size: 18px;
    padding: 10px 20px;
  }

  .combat-hp-bar-container {
    height: 20px;
  }

  .combat-mana-bar-container {
    height: 14px;
  }
}

@media screen and (max-height: 500px) and (orientation: landscape) {
  .combat-arena {
    padding: 8px;
    gap: 6px;
  }

  .combatant-sprite {
    width: 60px;
    height: 60px;
  }

  .pet-sprite {
    width: 40px;
    height: 40px;
  }

  .enemy-intent-container {
    margin: 5px auto;
  }

  .enemy-intent {
    font-size: 14px;
    padding: 6px 12px;
  }

  .phase-indicator {
    font-size: 14px;
    padding: 6px 12px;
    margin: 4px auto;
  }

  .combat-actions {
    padding: 8px 12px;
    gap: 6px;
  }

  .action-btn {
    padding: 10px 14px;
    font-size: 13px;
    min-width: 70px;
    min-height: 40px;
  }
}
