* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  min-height: 100vh;
  animation: backgroundShift 10s ease-in-out infinite alternate;
}

@keyframes backgroundShift {
  0% { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
  100% { background: linear-gradient(135deg, #764ba2 0%, #667eea 100%); }
}

#game {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  color: #2c3e50;
  max-width: 800px;
  width: 100%;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  animation: gameIntro 1s ease-out;
}

@keyframes gameIntro {
  from {
      opacity: 0;
      transform: translateY(-20px);
  }
  to {
      opacity: 1;
      transform: translateY(0);
  }
}

h1 {
  text-align: center;
  color: #8b5a2b;
  font-size: 2.5em;
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  from { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); }
  to { text-shadow: 2px 2px 4px rgba(139, 90, 43, 0.6); }
}

#stats, #controls, #monsterStats {
  margin-bottom: 20px;
  padding: 15px;
  border: 2px solid #34495e;
  border-radius: 15px;
  background: linear-gradient(145deg, #ecf0f1, #d5dbdb);
  box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.1);
}

#stats {
  background: linear-gradient(145deg, #e8f5e8, #c8e6c9);
  border-color: #4caf50;
}

#monsterStats {
  display: none;
  background: linear-gradient(145deg, #ffebee, #ef5350);
  color: #ffffff;
  border-color: #f44336;
  animation: monsterAppear 0.5s ease-out;
}

@keyframes monsterAppear {
  from {
      opacity: 0;
      transform: scale(0.8);
  }
  to {
      opacity: 1;
      transform: scale(1);
  }
}

.stat {
  display: inline-block;
  margin-right: 15px;
  font-weight: bold;
  font-size: 1.1em;
}

.stat strong {
  color: #2980b9;
}

#monsterStats .stat strong {
  color: #ffffff;
}

button {
  background: linear-gradient(145deg, #f39c12, #e67e22);
  border: 2px solid #d68910;
  color: #ffffff;
  padding: 15px 20px;
  margin: 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  font-size: 1.1em;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

button:hover::before {
  left: 100%;
}

button:hover {
  background: linear-gradient(145deg, #e67e22, #f39c12);
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#text {
  background: linear-gradient(145deg, #2c3e50, #34495e);
  color: #ecf0f1;
  padding: 20px;
  border-radius: 15px;
  font-size: 1.1em;
  line-height: 1.6;
  min-height: 120px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
  animation: textUpdate 0.3s ease-out;
}

@keyframes textUpdate {
  from {
      opacity: 0.7;
      transform: scale(0.98);
  }
  to {
      opacity: 1;
      transform: scale(1);
  }
}

/* Special effects for different game states */
.victory-mode {
  background: linear-gradient(145deg, #27ae60, #2ecc71) !important;
  animation: victoryPulse 1s ease-in-out infinite alternate;
}

@keyframes victoryPulse {
  from { box-shadow: 0 0 20px rgba(46, 204, 113, 0.5); }
  to { box-shadow: 0 0 30px rgba(46, 204, 113, 0.8); }
}

.defeat-mode {
  background: linear-gradient(145deg, #e74c3c, #c0392b) !important;
  animation: defeatShake 0.5s ease-in-out;
}

@keyframes defeatShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@media (min-width: 600px) {
  #controls {
      flex-direction: row;
      justify-content: space-between;
  }
  button {
      width: auto;
      flex: 1;
  }
}

@media (max-width: 480px) {
  #game {
      padding: 20px;
  }
  h1 {
      font-size: 2em;
  }
  button {
      font-size: 1em;
      padding: 12px 15px;
  }
  #text {
      font-size: 1em;
  }
}

/* Inventory display enhancement */
.inventory-highlight {
  color: #f39c12;
  font-weight: bold;
}

/* Health bar animation */
.low-health {
  animation: healthWarning 1s ease-in-out infinite alternate;
}

@keyframes healthWarning {
  from { color: #e74c3c; }
  to { color: #c0392b; }
}
