:root {
  --bg-color: #1a1a1a;
  --wall-color: #333333;
  --floor-color: #555555;
  --player-color: #42a5f5;
  --npc-color: #fdd835;
  --enemy-grunt-color: #ef5350;
  --enemy-tank-color: #bcaaa4;
  --enemy-boss-color: #7e57c2;
  --key-color: #ffee58;
  --door-color: #78909c;
  --item-color: #ab47bc;
  --heal-item-color: #26a69a;
  --village-color: #66bb6a;
  --text-color: #eeeeee;
  --ui-bg: #2a2a2a;
  --hp-bar: #4caf50;
  --hp-bar-enemy: #d32f2f;
  --hp-bar-bg: #555;
  --attack-viz-color: rgba(255, 238, 88, 0.5);
  --speech-bubble-bg: rgba(0, 0, 0, 0.7);
  --speech-bubble-border: #fff;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'Press Start 2P', cursive;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  text-shadow: 2px 2px #000;
}

#game-container {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: flex-start;
  gap: 1rem;
  justify-content: center;
}

canvas {
  background-color: #000;
  border: 4px solid var(--ui-bg);
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  max-width: 100%;
}

#ui-panel {
  background-color: var(--ui-bg);
  padding: 1.5rem;
  border: 4px solid #444;
  border-radius: 8px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  font-size: 0.8rem;
}

#pause-button {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.7rem;
  padding: 0.75rem;
  background-color: var(--ui-bg);
  color: var(--text-color);
  border: 2px solid var(--floor-color);
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  margin-top: 1rem;
  text-transform: uppercase;
}

.stat-block h2 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--key-color);
  border-bottom: 2px solid var(--floor-color);
  padding-bottom: 0.5rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

#hp-bar-container {
  width: 100%;
  background-color: var(--hp-bar-bg);
  border-radius: 4px;
  overflow: hidden;
  height: 20px;
  border: 2px solid #333;
}

#hp-bar {
  height: 100%;
  background-color: var(--hp-bar);
  width: 100%;
  transition: width 0.3s ease;
}

#inventory-list, #log-list {
  list-style: none;
  padding-left: 0;
}

#inventory-list li, #log-list li {
  margin-bottom: 0.5rem;
  color: #ccc;
}

#log-list li {
  font-size: 0.7rem;
  opacity: 0.8;
  line-height: 1.4;
}

#modal {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.7);
  justify-content: center;
  align-items: center;
}

#modal-content {
  background-color: var(--ui-bg);
  padding: 2rem;
  border: 4px solid var(--floor-color);
  border-radius: 8px;
  width: 80%;
  max-width: 500px;
  text-align: center;
  font-size: 1rem;
  line-height: 1.5;
}

#modal-content p {
  margin-bottom: 1rem;
}

#modal-button {
  background-color: var(--player-color);
  color: var(--text-color);
  border: none;
  padding: 0.75rem 1.5rem;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 4px;
  text-transform: uppercase;
}

#pause-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 15, 15, 0.85);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

#pause-box {
  background: #111;
  border: 3px solid var(--floor-color);
  color: var(--text-color);
  font-family: 'Press Start 2P', cursive;
  padding: 2rem;
  text-align: center;
  border-radius: 12px;
}

#pause-box h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

#pause-box p {
  font-size: 0.8rem;
  margin-bottom: 1.5rem;
}

#resume-button {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  background-color: var(--ui-bg);
  color: var(--text-color);
  border: 2px solid var(--floor-color);
  border-radius: 6px;
  cursor: pointer;
}

#restart-button {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  background-color: var(--ui-bg);
  color: var(--text-color);
  border: 2px solid var(--floor-color);
  border-radius: 6px;
  cursor: pointer;
}