body {
  font-family: "Press Start 2P", cursive;
  background-color: #000;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  box-sizing: border-box;
}
.game-container {
  width: 100%;
  max-width: 800px;
  border: 4px solid #fff;
  padding: 20px;
  background-color: #000;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
  border-radius: 8px;
}
.dialogue-box {
  min-height: 150px;
  max-height: 300px; /* Added max height */
  border: 2px solid #fff;
  padding: 15px;
  margin-bottom: 20px;
  line-height: 1.8;
  font-size: clamp(16px, 2.5vw, 24px); /* Responsive font size */
  overflow-y: auto;
  overflow-x: hidden; /* Prevent horizontal scrolling */
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.8);
  word-wrap: break-word;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.dialogue-box p {
  margin-bottom: 10px;
  word-wrap: break-word;
  width: 100%;
  box-sizing: border-box;
}
#textLine {
  display: block;
  width: 100%;
  transform: translate3d(0, 0, 0);
  font-size: inherit; /* Inherits from dialogue-box */
  hyphens: auto; /* Optional hyphenation */
}
.speaker {
  font-weight: bold;
  color: #ffff00;
}
.narrator-text {
  color: #cccccc;
  font-style: italic;
}
.darkness-text {
  color: #920000;
  font-style: italic;
}

.the-voices-in-my-head-text {
  font-style: italic;
  color: #888888;
}

.options-container button {
  background-color: #222;
  color: #fff;
  border: 2px solid #fff;
  padding: 10px 20px;
  margin: 5px;
  cursor: pointer;
  font-family: "Press Start 2P", cursive;
  font-size: 14px;
  border-radius: 4px;
  transition:
    background-color 0.3s,
    color 0.3s;
}
.mana-bar-container {
  width: 100%;
  height: 20px;
  border: 2px solid #444;
  background-color: #111;
  margin-top: 10px;
}
.mana-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0044ff, #00aaff);
  transition: width 0.3s ease-in-out;
}

.options-container button:hover {
  background-color: #fff;
  color: #000;
}
.objective-box {
  border: 2px solid #00ff00;
  padding: 10px;
  margin-top: 15px;
  margin-bottom: 15px;
  color: #00ff00;
  text-align: center;
  font-size: 14px;
  border-radius: 4px;
}

/* Fade effect */
.fade-out {
  animation: fadeOut 1s forwards;
}
.fade-in {
  animation: fadeIn 1s forwards;
}
@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* CRT effects */
.crt-flicker {
  position: relative;
  animation: crtFlicker 0.1s infinite;
}
@keyframes crtFlicker {
  0%,
  100% {
    opacity: 1;
    text-shadow: 0 0 1px rgba(0, 255, 0, 0.3);
  }
  20% {
    opacity: 0.8;
    transform: translateY(-2px);
  }
  40% {
    opacity: 0.6;
    text-shadow: 0 0 2px rgba(0, 255, 255, 0.4);
  }
  60% {
    opacity: 0.4;
    transform: translateY(2px);
  }
  80% {
    opacity: 0.2;
    text-shadow: 0 0 3px rgba(255, 0, 255, 0.3);
  }
}
.crt-scanlines {
  position: relative;
}
.crt-scanlines::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 255, 0, 0.05) 50%,
    transparent 100%
  );
  background-size: 100% 3px;
  pointer-events: none;
  z-index: 1;
}

/* Message Box */
.message-box-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s,
    visibility 0.3s;
}
.message-box-overlay.active {
  opacity: 1;
  visibility: visible;
}
.message-box-content {
  background-color: #111;
  color: #fff;
  padding: 30px;
  border: 3px solid #fff;
  border-radius: 8px;
  text-align: center;
  max-width: 80%;
  font-size: 16px;
}
.message-box-content button {
  background-color: #333;
  color: #fff;
  border: 2px solid #fff;
  padding: 8px 16px;
  margin-top: 20px;
  cursor: pointer;
  font-family: "Press Start 2P", cursive;
  border-radius: 4px;
}
.message-box-content button:hover {
  background-color: #fff;
  color: #000;
}

/* Fight System */
.fight-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1001;
}
.fight-container {
  width: 90%;
  max-width: 800px;
  border: 4px solid #fff;
  padding: 20px;
  background-color: #000;
  border-radius: 8px;
  justify-content: center;
  align-items: center;
}
.fight-arena {
  display: flex;
  justify-content: space-around;
  align-items: center;
  min-height: 200px;
  margin-bottom: 20px;
  border: 2px solid #444;
  padding: 20px;
  position: relative;
}
.character-cube {
  width: 50px;
  height: 50px;
  margin: 10px;
  position: relative;
  transition: transform 0.2s;
}
.character-cube:hover {
  transform: scale(1.1);
}
.character-health {
  position: absolute;
  bottom: -20px;
  width: 100%;
  text-align: center;
  font-size: 10px;
  color: white;
  transition: color 0.3s ease-in-out;
}
.fight-options {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
}
.fight-option {
  background-color: #222;
  color: #fff;
  border: 2px solid #fff;
  padding: 10px 20px;
  cursor: pointer;
  font-family: "Press Start 2P", cursive;
  font-size: 12px;
  border-radius: 4px;
  transition: all 0.3s;
}
.fight-option:hover {
  background-color: #fff;
  color: #000;
}
.fight-suboptions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}
.timing-bar {
  width: 100%;
  height: 30px;
  background-color: #333;
  margin-top: 20px;
  position: relative;
  border: 2px solid #555;
}
.timing-indicator {
  position: absolute;
  width: 10px;
  height: 100%;
  background-color: #fff;
  left: 0;
  animation: timingSwing 2s infinite linear;
}
.perfect-zone {
  position: absolute;
  height: 100%;
  width: 10%;
  background-color: rgba(0, 255, 0, 0.3);
  left: 40%;
}
@keyframes timingSwing {
  0% {
    left: 0;
  }
  50% {
    left: 100%;
    transform: translateX(-100%);
  }
  100% {
    left: 0;
  }
}
.item-option {
  background-color: #333;
  color: #fff;
  border: 2px solid #666;
  padding: 8px 15px;
  cursor: pointer;
  font-family: "Press Start 2P", cursive;
  font-size: 10px;
  border-radius: 4px;
}
.item-option:hover {
  background-color: #666;
}

/* Italics handling */
.dialogue-box em {
  font-style: italic;
  color: inherit;
}
.narrator-text em {
  font-style: italic;
  color: #cccccc;
}
