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

body {
  font-family: 'Press Start 2P', monospace;
  background: #2c1810;
  color: #fff;
  overflow: hidden;
  font-size: 10px;
}

#game-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  position: relative;
}

#gameCanvas {
  max-width: 100%;
  max-height: 100vh;
  border: 4px solid #8b4513;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  position: absolute;
  z-index: 1;
}

#ui-overlay {
  position: absolute;
  width: 540px;
  height: 960px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

#ui-overlay > * {
  pointer-events: auto;
}

/* Sección de enemigos - parte superior */
#enemy-section {
  height: 200px;
  background: rgba(0, 0, 0, 0.8);
  border-bottom: 2px solid #8b4513;
  display: flex;
  flex-direction: column;
  padding: 25px 10px 10px 10px;
}

#enemy-info {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

#enemy-display {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#enemy-name {
  font-size: 14px;
  color: #ff6b6b;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  font-weight: bold;
}

#enemy-sprite {
  font-size: 24px;
}

.turn-indicator {
  text-align: center;
  font-size: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 5px;
}

.turn-indicator.player-turn {
  background: rgba(76, 175, 80, 0.3);
  border: 1px solid #4CAF50;
  color: #4CAF50;
}

.turn-indicator.enemy-turn {
  background: rgba(255, 107, 107, 0.3);
  border: 1px solid #ff6b6b;
  color: #ff6b6b;
}

.combat-message {
  text-align: center;
  font-size: 7px;
  min-height: 15px;
  color: #fff;
}

.combat-message.player-damage {
  color: #4CAF50;
}

.combat-message.enemy-damage {
  color: #ff6b6b;
}

.combat-message.enemy-action {
  color: #ffd700;
}

/* Enemy sprites - 8-bit style */
.enemy-sprite {
  width: 80px;
  height: 80px;
  margin: 0 auto;
  position: relative;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
}

.enemy-sprite.catty-perry {
  background: linear-gradient(
    to bottom,
    #ff69b4 0%, #ff69b4 20%,
    #ffd700 20%, #ffd700 40%,
    #ff1493 40%, #ff1493 60%,
    #4169e1 60%, #4169e1 80%,
    #333 80%, #333 100%
  );
  border-radius: 50% 50% 40% 40%;
  animation: bobbing 2s ease-in-out infinite;
}

.enemy-sprite.purrlock-holmes {
  background: linear-gradient(
    45deg,
    #8b4513 0%, #8b4513 30%,
    #daa520 30%, #daa520 50%,
    #654321 50%, #654321 70%,
    #2f4f4f 70%, #2f4f4f 100%
  );
  border-radius: 20% 20% 50% 50%;
  position: relative;
}

.enemy-sprite.purrlock-holmes::before {
  content: '🔍';
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 20px;
  animation: rotate 3s linear infinite;
}

.enemy-sprite.catman {
  background: linear-gradient(
    to bottom,
    #1e90ff 0%, #1e90ff 30%,
    #ffd700 30%, #ffd700 50%,
    #333 50%, #333 70%,
    #696969 70%, #696969 100%
  );
  border-radius: 30% 30% 20% 20%;
  position: relative;
}

.enemy-sprite.catman::after {
  content: '';
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 20px;
  background: #1e90ff;
  border-radius: 50%;
  border: 2px solid #000080;
}

.enemy-sprite.meowleficent {
  background: radial-gradient(
    circle,
    #4b0082 0%, #4b0082 40%,
    #8b008b 40%, #8b008b 60%,
    #2f2f2f 60%, #2f2f2f 80%,
    #000 80%, #000 100%
  );
  border-radius: 30% 70% 70% 30%;
  position: relative;
  animation: pulse 2s ease-in-out infinite;
}

.enemy-sprite.meowleficent::before {
  content: '⚡';
  position: absolute;
  top: -5px;
  left: -5px;
  font-size: 16px;
  animation: flicker 1s ease-in-out infinite;
}

.enemy-sprite.catulhu {
  background: radial-gradient(
    ellipse,
    #006400 0%, #006400 25%,
    #8fbc8f 25%, #8fbc8f 50%,
    #2f4f2f 50%, #2f4f2f 75%,
    #000 75%, #000 100%
  );
  border-radius: 50% 20% 50% 20%;
  position: relative;
  animation: tentacle-wiggle 1.5s ease-in-out infinite;
}

.enemy-sprite.catulhu::after {
  content: '🐙';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  filter: hue-rotate(120deg);
}

/* Animations */
@keyframes bobbing {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

@keyframes rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

@keyframes flicker {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0.5; }
}

@keyframes tentacle-wiggle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-2deg) scale(1.02); }
  50% { transform: rotate(2deg) scale(0.98); }
  75% { transform: rotate(-1deg) scale(1.01); }
}

/* Damage feedback effects */
@keyframes damage-flash {
  0% { background-color: rgba(255, 0, 0, 0); }
  50% { background-color: rgba(255, 0, 0, 0.7); }
  100% { background-color: rgba(255, 0, 0, 0); }
}

@keyframes heal-flash {
  0% { background-color: rgba(0, 255, 0, 0); }
  50% { background-color: rgba(0, 255, 0, 0.7); }
  100% { background-color: rgba(0, 255, 0, 0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
  20%, 40%, 60%, 80% { transform: translateX(3px); }
}

@keyframes score-popup {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateY(-20px) scale(1.2);
    opacity: 0.8;
  }
  100% {
    transform: translateY(-40px) scale(1);
    opacity: 0;
  }
}

/* Floating damage numbers */
.damage-popup {
  position: absolute;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  font-weight: bold;
  pointer-events: none;
  z-index: 1000;
  animation: score-popup 1.5s ease-out forwards;
}

.damage-popup.damage {
  color: #ff4444;
  text-shadow: 1px 1px 0px #000;
}

.damage-popup.heal {
  color: #44ff44;
  text-shadow: 1px 1px 0px #000;
}

.damage-popup.score {
  color: #ffd700;
  text-shadow: 1px 1px 0px #000;
}

/* Effect classes for triggering animations */
.damage-effect {
  animation: damage-flash 0.5s ease-out, shake 0.5s ease-out;
}

.heal-effect {
  animation: heal-flash 0.5s ease-out;
}

/* Sección del jugador - parte inferior */
#player-section {
  height: 360px;
  background: rgba(0, 0, 0, 0.9);
  border-top: 2px solid #8b4513;
  padding: 10px 20px 20px 20px;
  display: flex;
  flex-direction: column;
}

#player-info {
  margin-bottom: 10px;
  border-bottom: 1px solid #666;
  padding-bottom: 8px;
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-label {
  font-size: 10px;
  color: #4CAF50;
  font-weight: bold;
}

/* HP Bars */
.hp-container {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 7px;
}

.hp-bar {
  width: 60px;
  height: 12px;
  background: #333;
  border: 1px solid #666;
  position: relative;
  overflow: hidden;
}

.hp-bar-fill {
  height: 100%;
  background: linear-gradient(to bottom, #4CAF50, #2e7d32);
  transition: width 0.5s ease;
  width: 100%;
}

.hp-bar-fill.low {
  background: linear-gradient(to bottom, #f44336, #c62828);
}

#dice-section {
  padding: 10px 0;
}

#dice-container {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 15px;
}

.die {
  width: 50px;
  height: 50px;
  background: #fff;
  border: 3px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  image-rendering: pixelated;
  position: relative;
  color: #000;
}

.die.empty {
  background: #666;
  border-color: #444;
  color: #aaa;
  cursor: default;
}

.die.locked {
  background: #ffd700;
  border-color: #ff8c00;
}

.die .lock-indicator {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 12px;
  display: none;
}

.die.locked .lock-indicator {
  display: block;
}

#roll-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

#roll-count {
  font-size: 8px;
  color: #ccc;
}

button {
  background: #4CAF50;
  color: white;
  border: 3px solid #2e7d32;
  padding: 8px 16px;
  font-size: 8px;
  font-family: inherit;
  cursor: pointer;
  min-height: 30px;
  image-rendering: pixelated;
}

button:active {
  background: #45a049;
  transform: translateY(1px);
}

button:disabled {
  background: #666;
  border-color: #444;
  cursor: not-allowed;
}

#combinations-display {
  min-height: 40px;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px;
  border: 1px solid #666;
  font-size: 7px;
  line-height: 12px;
}

#scorecard-section {
  height: 400px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.85);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.scorecard-title {
  text-align: center;
  margin-bottom: 10px;
  font-size: 12px;
  color: #ffd700;
}

.scorecard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.scorecard-column {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #666;
  padding: 8px;
}

.section-title {
  text-align: center;
  margin-bottom: 8px;
  font-size: 8px;
  color: #ffd700;
  border-bottom: 1px solid #666;
  padding-bottom: 4px;
}

.slot {
  padding: 6px 4px;
  border: 1px solid #666;
  font-size: 7px;
  min-height: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.slot:hover {
  background: rgba(255, 255, 255, 0.1);
}

.slot.available {
  border-color: #0f0;
  background: rgba(0, 255, 0, 0.1);
}

.slot.player-owned {
  background: rgba(76, 175, 80, 0.3);
  border-color: #4CAF50;
  cursor: default;
}

.slot.enemy-owned {
  background: rgba(255, 107, 107, 0.3);
  border-color: #ff6b6b;
  cursor: default;
}

.slot.enemy-owned.beatable {
  background: rgba(255, 165, 0, 0.4);
  border-color: #ffa500;
  cursor: pointer;
  animation: pulse-beatable 1s infinite;
}

@keyframes pulse-beatable {
  0% { box-shadow: 0 0 5px rgba(255, 165, 0, 0.5); }
  50% { box-shadow: 0 0 15px rgba(255, 165, 0, 0.8); }
  100% { box-shadow: 0 0 5px rgba(255, 165, 0, 0.5); }
}

.slot.blocked {
  background: rgba(128, 0, 128, 0.3);
  border-color: #800080;
  cursor: default;
  position: relative;
}

.slot.blocked::after {
  content: "BLOCKED";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 5px;
  color: #800080;
  font-weight: bold;
}

.bonus-slot {
  padding: 6px 4px;
  border: 2px solid #ffd700;
  font-size: 7px;
  min-height: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  background: rgba(255, 215, 0, 0.1);
}

.slot-name {
  flex: 1;
}

.slot-value {
  font-weight: bold;
  min-width: 20px;
  text-align: right;
}

@media (max-width: 600px) {
  #ui-overlay {
    width: 100vw;
    height: 100vh;
  }

  #gameCanvas {
    width: 100vw;
    height: 100vh;
  }

  .slot {
    font-size: 6px;
    padding: 4px;
    min-height: 25px;
  }

  .die {
    width: 45px;
    height: 45px;
    font-size: 16px;
  }

  button {
    font-size: 7px;
    padding: 6px 12px;
  }
}

/* Dados del enemigo */
#enemy-dice-section {
  padding: 8px;
  background: rgba(255, 107, 107, 0.1);
  border-top: 1px solid #ff6b6b;
}

#enemy-dice-container {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 5px;
}

.enemy-die {
  width: 25px;
  height: 25px;
  background: #ff6b6b;
  border: 2px solid #ff4444;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  color: white;
  position: relative;
}

.enemy-die.locked {
  background: #cc5555;
  border-color: #aa3333;
}

#enemy-roll-info {
  text-align: center;
  font-size: 6px;
  color: #ff6b6b;
}

/* Visual feedback animations */

/* Floating damage animation */
@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateY(0px);
  }
  100% {
    opacity: 0;
    transform: translateY(-50px);
  }
}

/* Action feedback animations */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Damage effect on sprites */
.enemy-sprite.hit {
  animation: hitFlash 0.5s ease-in-out;
}

.player-info.hit {
  animation: hitFlash 0.5s ease-in-out;
}

@keyframes hitFlash {
  0%, 100% { filter: brightness(1); }
  25% { filter: brightness(1.5) hue-rotate(0deg); }
  50% { filter: brightness(2) hue-rotate(90deg); }
  75% { filter: brightness(1.5) hue-rotate(180deg); }
}

/* Score placement feedback */
.slot.score-placed {
  animation: scorePlaced 0.8s ease-out;
}

@keyframes scorePlaced {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); background-color: rgba(76, 175, 80, 0.3); }
  100% { transform: scale(1); }
}

/* Enemy action feedback */
.slot.enemy-placed {
  animation: enemyPlaced 0.8s ease-out;
}

@keyframes enemyPlaced {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); background-color: rgba(255, 107, 107, 0.3); }
  100% { transform: scale(1); }
}

/* Dice roll animation enhancement */
.die.rolling {
  animation: diceRoll 0.6s ease-in-out;
}

@keyframes diceRoll {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(90deg) scale(1.1); }
  50% { transform: rotate(180deg) scale(1.2); }
  75% { transform: rotate(270deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

/* Power activation effects */
.enemy-sprite.power-active {
  animation: powerActivation 1s ease-in-out;
}

@keyframes powerActivation {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.8) drop-shadow(0 0 10px currentColor); }
}

/* Add smooth transitions */
.enemy-sprite {
  transition: all 0.3s ease;
}

.slot {
  transition: all 0.2s ease;
}

/* Enhanced HP bar animations */
.hp-bar-fill {
  transition: width 0.5s ease-out, background-color 0.3s ease;
}

.hp-bar-fill.low {
  animation: lowHpPulse 1s ease-in-out infinite alternate;
}

@keyframes lowHpPulse {
  0% { background-color: #ff4444; }
  100% { background-color: #cc2222; }
}

/* Turn indicator enhancements */
.turn-indicator {
  transition: all 0.3s ease;
}

.turn-indicator.player-turn {
  animation: playerTurnGlow 2s ease-in-out infinite alternate;
}

.turn-indicator.enemy-turn {
  animation: enemyTurnGlow 2s ease-in-out infinite alternate;
}

@keyframes playerTurnGlow {
  0% { box-shadow: 0 0 5px rgba(76, 175, 80, 0.5); }
  100% { box-shadow: 0 0 15px rgba(76, 175, 80, 0.8); }
}

@keyframes enemyTurnGlow {
  0% { box-shadow: 0 0 5px rgba(255, 107, 107, 0.5); }
  100% { box-shadow: 0 0 15px rgba(255, 107, 107, 0.8); }
}

/* Combat message enhancements */
.combat-message {
  transition: all 0.3s ease;
}

.combat-message.player-damage {
  color: #4CAF50;
  text-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
}

.combat-message.enemy-damage {
  color: #ff6b6b;
  text-shadow: 0 0 5px rgba(255, 107, 107, 0.5);
}

.combat-message.enemy-action {
  color: #ff9800;
  text-shadow: 0 0 5px rgba(255, 152, 0, 0.5);
}

/* Button hover effects */
button {
  transition: all 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Dice enhancements */
.die {
  transition: all 0.2s ease;
}

.die:hover {
  transform: scale(1.05);
}

.die.locked:hover {
  transform: scale(1.02);
}

/* Enemy dice visual improvements */
.enemy-die {
  transition: all 0.2s ease;
}

/* Slot hover improvements */
.slot.available:hover {
  transform: scale(1.02);
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.slot.beatable:hover {
  transform: scale(1.02);
  box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}

/* Game container polish */
#game-container {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

/* UI overlay improvements */
#ui-overlay {
  backdrop-filter: blur(2px);
}