body {
  font-family: Arial, sans-serif;
  background: linear-gradient(135deg, #0a0a23, #1a1a3a);
  color: white;
  margin: 0;
  padding: 20px;
}
.container {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  color: #333;
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.header {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  text-align: center;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 15px 0;
}
.stat-card {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.stat-label {
  font-size: 12px;
  color: #666;
  margin-bottom: 5px;
}
.stat-value {
  font-size: 18px;
  font-weight: bold;
  color: #0a0a23;
}
.progress-bar {
  width: 100%;
  height: 6px;
  background: #ddd;
  border-radius: 3px;
  margin-top: 5px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.health-bar {
  background: #28a745;
}
.mana-bar {
  background: #007bff;
}
.xp-bar {
  background: #ffc107;
}
.monster-bar {
  background: #dc3545;
}
#text {
  background: #0a0a23;
  color: white;
  padding: 20px;
  border-radius: 8px;
  margin: 15px 0;
  min-height: 80px;
  line-height: 1.5;
}
#monsterStats {
  display: none;
  background: #dc3545;
  color: white;
  padding: 15px;
  border-radius: 8px;
  text-align: center;
  margin: 15px 0;
}
.controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 20px 0;
}
.btn {
  padding: 12px 15px;
  font-size: 14px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(145deg, #feac32, #ffac33);
  color: #0a0a23;
  transition: all 0.2s ease;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.btn-primary {
  background: linear-gradient(145deg, #feac32, #ffac33);
  color: #0a0a23;
}
.btn-secondary {
  background: linear-gradient(145deg, #6c757d, #5a6268);
  color: white;
}
.spell-buttons {
  display: none;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 15px 0;
}
.spell-btn {
  padding: 8px;
  font-size: 12px;
  background: #6f42c1;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
.spell-btn:hover {
  background: #5a32a3;
}
.spell-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#combatLog {
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 10px;
  height: 120px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 12px;
  margin: 15px 0;
}
.log-damage {
  color: #dc3545;
  font-weight: bold;
}
.log-heal {
  color: #28a745;
  font-weight: bold;
}
.log-miss {
  color: #666;
  font-style: italic;
}
.log-critical {
  color: #ff6b35;
  font-weight: bold;
}
.log-level {
  color: #007bff;
  font-weight: bold;
}
.log-magic {
  color: #6f42c1;
  font-weight: bold;
}
.level-up-animation {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ffd700;
  color: #333;
  padding: 20px;
  border-radius: 10px;
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  animation: levelUpPop 2s ease;
  z-index: 1000;
}
@keyframes levelUpPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}
.save-load {
  display: flex;
  gap: 8px;
  margin: 15px 0;
}
.save-load button {
  flex: 1;
  padding: 8px;
  font-size: 12px;
}



@media (max-width: 600px) {
  .controls {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
/* Critical hit glow (red) */
@keyframes critGlow {
  0%   { box-shadow: 0 0 5px 2px red; }
  100% { box-shadow: none; }
}

/* Miss glow (grey) */
@keyframes missGlow {
  0%   { box-shadow: 0 0 5px 2px grey; }
  100% { box-shadow: none; }
}

/* Apply the classes */
.crit-effect {
  animation: critGlow 0.5s ease;
}

.miss-effect {
  animation: missGlow 0.5s ease;
}
