body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Arial', sans-serif;
}

/* Start Screen (Unchanged per caveat) */
#start-screen {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2vh 0;
  box-sizing: border-box;
}

#start-screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
}

#gradient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(125, 15, 15, 0.7) 0%, rgba(125, 15, 15, 0) 33.33%);
  z-index: 2;
}

#shade {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #9945FF;
  animation: fadeColors 10s infinite;
  z-index: 1;
  opacity: 0.7;
}

@keyframes fadeColors {
  0% { background: #9945FF; }
  33% { background: #3C3CFF; }
  66% { background: #F7931A; }
  100% { background: #9945FF; }
}

.title-container {
  width: 100%;
  text-align: center;
  padding: clamp(20px, 5vh, 40px);
  background: radial-gradient(circle at center, rgba(75, 0, 130, 0.9) 0%, rgba(139, 0, 0, 0.8) 50%, rgba(0, 0, 0, 0.9) 100%);
  background-size: 200% 200%;
  animation: swirlGalaxy 15s infinite ease-in-out;
  z-index: 3;
  margin-top: 20vh;
  position: relative;
  overflow: visible;
}

.starfield {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.starfield span {
  position: absolute;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  animation: twinkle 2s infinite ease-in-out;
}

.starfield span:nth-child(1) { top: 10%; left: 10%; width: 3px; height: 3px; animation-delay: 0s; }
.starfield span:nth-child(2) { top: 15%; left: 20%; width: 2px; height: 2px; animation-delay: 0.2s; }
.starfield span:nth-child(3) { top: 20%; left: 30%; width: 4px; height: 4px; animation-delay: 0.4s; }
.starfield span:nth-child(4) { top: 25%; left: 40%; width: 3px; height: 3px; animation-delay: 0.6s; }
.starfield span:nth-child(5) { top: 30%; left: 50%; width: 2px; height: 2px; animation-delay: 0.8s; }
.starfield span:nth-child(6) { top: 35%; left: 60%; width: 3px; height: 3px; animation-delay: 1s; }
.starfield span:nth-child(7) { top: 40%; left: 70%; width: 2px; height: 2px; animation-delay: 1.2s; }
.starfield span:nth-child(8) { top: 45%; left: 80%; width: 4px; height: 4px; animation-delay: 1.4s; }
.starfield span:nth-child(9) { top: 50%; left: 15%; width: 3px; height: 3px; animation-delay: 1.6s; }
.starfield span:nth-child(10) { top: 55%; left: 25%; width: 2px; height: 2px; animation-delay: 1.8s; }
.starfield span:nth-child(11) { top: 60%; left: 35%; width: 3px; height: 3px; animation-delay: 2s; }
.starfield span:nth-child(12) { top: 65%; left: 45%; width: 2px; height: 2px; animation-delay: 2.2s; }
.starfield span:nth-child(13) { top: 70%; left: 55%; width: 4px; height: 4px; animation-delay: 2.4s; }
.starfield span:nth-child(14) { top: 75%; left: 65%; width: 3px; height: 3px; animation-delay: 2.6s; }
.starfield span:nth-child(15) { top: 80%; left: 75%; width: 2px; height: 2px; animation-delay: 2.8s; }

.shooting-stars {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.shooting-stars::before,
.shooting-stars::after,
.shooting-stars > span::before,
.shooting-stars > span::after {
  content: '';
  position: absolute;
  width: 60px;
  height: 2px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.0), rgba(255, 255, 255, 0.9));
  animation: shootingStar 5s infinite linear;
}

.shooting-stars::before { top: 20%; left: -60px; animation-delay: 0s; transform: rotate(0deg); }
.shooting-stars::after { top: 40%; left: -60px; animation-delay: 1.5s; transform: rotate(0deg); }
.shooting-stars > span::before { top: 60%; left: -60px; animation-delay: 3s; transform: rotate(0deg); }
.shooting-stars > span::after { top: 80%; left: -60px; animation-delay: 4s; transform: rotate(0deg); }

.shooting-stars > span {
  position: absolute;
  width: 0;
  height: 0;
}

@keyframes swirlGalaxy {
  0% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
  100% { background-position: 0% 0%; }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.9; }
}

@keyframes shootingStar {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  10% {
    transform: translateX(100vw);
    opacity: 0;
  }
  100% {
    transform: translateX(100vw);
    opacity: 0;
  }
}

.title-container h1 {
  color: white;
  font-size: clamp(1.2em, 4vw, 1.9em);
  font-weight: bold;
  text-transform: uppercase;
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  position: relative;
  z-index: 2;
}

.button-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(15px, 2vh, 25px);
  z-index: 3;
  margin-top: 5vh;
  flex-grow: 1;
}

#start-button {
  padding: clamp(10px, 2vh, 15px) clamp(20px, 5vw, 40px);
  width: clamp(200px, 40vw, 250px);
  font-size: clamp(1em, 3vw, 1.5em);
  cursor: pointer;
  background-color: #F7931A;
  color: black;
  font-weight: bold;
  border: 3px solid #D97706;
  border-radius: 10px;
  box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.5);
  transition: background 0.3s ease, border-color 0.3s ease;
  animation: pulseGlowBitcoinOrange 1.5s infinite ease-in-out;
}

#start-button:hover {
  background-color: #E68A17;
  border-color: #C66D05;
}

#boss-rush-button {
  padding: clamp(10px, 2vh, 15px) clamp(20px, 5vw, 40px);
  width: clamp(200px, 40vw, 250px);
  font-size: clamp(1em, 3vw, 1.5em);
  cursor: pointer;
  background-color: #ff5555;
  color: white;
  font-weight: bold;
  border: 3px solid #e63c3c;
  border-radius: 10px;
  box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.5);
  transition: background 0.3s ease, border-color 0.3s ease;
  animation: pulseGlowRed 1.5s infinite ease-in-out;
}

#boss-rush-button:hover {
  background-color: #ff3333;
  border-color: #e61a1a;
}

#instructions-button {
  padding: clamp(10px, 2vh, 15px) clamp(20px, 5vw, 40px);
  width: clamp(200px, 40vw, 250px);
  font-size: clamp(1em, 3vw, 1.5em);
  cursor: pointer;
  background-color: #55ffff;
  color: black;
  font-weight: bold;
  border: 3px solid #3ce6e6;
  border-radius: 10px;
  box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.5);
  transition: background 0.3s ease, border-color 0.3s ease;
}

#instructions-button:hover {
  background-color: #33dddd;
  border-color: #1ac4c4;
}

#settings-button {
  padding: clamp(10px, 2vh, 15px) clamp(20px, 5vw, 40px);
  width: clamp(200px, 40vw, 250px);
  font-size: clamp(1em, 3vw, 1.5em);
  cursor: pointer;
  background-color: #55ff55;
  color: black;
  font-weight: bold;
  border: 3px solid #3ce63c;
  border-radius: 10px;
  box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.5);
  transition: background 0.3s ease, border-color 0.3s ease;
}

#settings-button:hover {
  background-color: #33dd33;
  border-color: #1ac41a;
}

#quick-guide-button {
  padding: clamp(10px, 2vh, 15px) clamp(20px, 5vw, 40px);
  width: clamp(200px, 40vw, 250px);
  font-size: clamp(1em, 3vw, 1.5em);
  cursor: pointer;
  background-color: #ff5555;
  color: white;
  font-weight: bold;
  border: 3px solid #e63c3c;
  border-radius: 10px;
  box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.5);
  transition: background 0.3s ease, border-color 0.3s ease;
}

#quick-guide-button:hover {
  background-color: #dd3333;
  border-color: #c41a1a;
}

.switch-container {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  width: clamp(200px, 40vw, 250px);
}

#lore-button {
  padding: 8px 16px;
  font-size: 1em;
  cursor: pointer;
  background: linear-gradient(to right, #4B0082, #7B68EE);
  color: white;
  font-weight: bold;
  border: 3px solid #6633CC;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  font-family: 'Arial', sans-serif;
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
}

#lore-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
  border-color: #7B68EE;
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #C66D05;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #E68A17;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.byline {
  font-family: 'Arial', sans-serif;
  font-size: clamp(0.6em, 2vw, 0.7em);
  color: #ffffff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  z-index: 3;
  margin-bottom: 1vh;
  text-align: center;
}

#byline {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  color: white;
  font-family: 'Arial', sans-serif;
  font-size: clamp(8px, 1vw, 12px);
  z-index: 3;
  text-align: center;
  width: 100%;
  padding: 0 20px;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Updated Canvas Styling for Scaling */
canvas {
  display: none; /* Hidden initially, shown during game */
  position: absolute;
  z-index: 5; /* Above start screen, below UI elements */
  /* Dimensions and positioning will be set by resizeGame in JS */
}

/* Scoreboard (Adjusted for visibility over scaled canvas) */
#scoreboard {
  position: fixed;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(0.6vw, 1vh, 1.2vw);
  padding: clamp(8px, 1.5vh, 12px) clamp(16px, 2vw, 24px);
  gap: clamp(12px, 2.5vw, 20px);
  font-family: 'Press Start 2P', sans-serif;
  color: #ffffff;
  text-align: center;
  z-index: 15;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  min-width: 200px;
  max-width: 1500px;
  width: fit-content;
}

#scoreboard .stat {
  padding: 2px 5px;
  text-align: center;
  white-space: nowrap;
  position: relative;
  flex-shrink: 0;
}

#scoreboard .stat:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 80%;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 1px;
}

#scoreboard .wizards-killed { color: #ff5555; }
#scoreboard .poop { color: #d2b48c; }
#scoreboard .join-us { color: #f7931a; }
#scoreboard .lives { color: #55ff55; }
#scoreboard .time { color: #ffff55; }

/* Pause Button (Positioned relative to scaled canvas) */
#pause-button {
  display: none; /* Initially hidden, shown during game */
  position: fixed;
  top: 5px;
  right: 5px;
  background-color: #F7931A;
  color: white;
  padding: 5px 10px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  z-index: 10; /* Above canvas */
  font-family: 'Arial', sans-serif;
  font-size: 1em;
}

/* End Game Screen (Updated to overlay scaled canvas) */
#end-game-screen {
  position: fixed; /* Changed to fixed to stay above canvas */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 20; /* Above everything */
}

#end-game-screen h2 {
  font-size: 2em;
  margin-bottom: 25px;
}

#end-game-screen p {
  font-size: 1.2em;
  margin: 15px 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* End Game Button */
#end-game-button {
  display: none !important;
  position: fixed;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  z-index: 1000;
  transition: background-color 0.3s ease;
  outline: none;
  pointer-events: auto;
}

.game-screen #end-game-button {
  display: block !important;
}

#end-game-button:hover {
  background: rgba(255, 255, 255, 0.3);
}

#end-game-button:active {
  background: rgba(255, 255, 255, 0.2);
  opacity: 0.2;
}

#end-game-button img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  opacity: 0.3;
}

#replay-button {
  padding: clamp(10px, 1.5vh, 15px) clamp(20px, 3vw, 30px);
  font-size: clamp(1em, 1.5vw, 1.2em);
  cursor: pointer;
  background-color: #fff;
  border: none;
  border-radius: 10px;
  margin-top: 20px;
  transition: background 0.3s ease;
  animation: pulseGlowWhite 1.5s infinite ease-in-out;
}

#replay-button:hover {
  background-color: #ddd;
}

#next-life-button {
  padding: clamp(10px, 1.5vh, 15px) clamp(20px, 3vw, 30px);
  font-size: clamp(1em, 1.5vw, 1.2em);
  cursor: pointer;
  background-color: #fff;
  border: none;
  border-radius: 10px;
  margin-top: 20px;
}

#next-life-button:hover {
  background-color: #ddd;
}

#play-again-button {
  padding: clamp(12px, 1.5vh, 16px) clamp(20px, 3vw, 30px);
  font-size: clamp(1em, 1.5vw, 1.2em);
  cursor: pointer;
  background-color: #fff;
  border: none;
  border-radius: 10px;
  margin-top: 20px;
}

#play-again-button:hover {
  background-color: #ddd;
}

#back-to-start-button {
  padding: clamp(12px, 1.5vh, 16px) clamp(20px, 3vw, 30px);
  font-size: clamp(1em, 1.5vw, 1.2em);
  cursor: pointer;
  background-color: #fff;
  border: none;
  border-radius: 10px;
  margin-top: 25px;
}

#back-to-start-button:hover {
  background-color: #ddd;
}

/* Life Ended Screen (Unchanged per caveat) */
#life-ended-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('images/gravebackground.jpg');
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 20;
}

#life-ended-screen .content-block {
  background-color: rgba(0, 0, 0, 0.9);
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  min-width: 300px;
}

#life-ended-screen h2 {
  font-size: 2em;
  margin: 0 0 25px;
  color: white;
}

#life-ended-screen p {
  font-size: 1.2em;
  margin: 15px 0;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

#final-cat-image {
  width: 100px;
  height: 100px;
  margin-bottom: 20px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Tips Screen (Unchanged per caveat) */
#tips-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('images/tipsbackground.jpeg');
  background-color: rgba(247, 147, 26, 0.5);
  background-size: cover;
  background-position: center;
  background-blend-mode: overlay;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 20;
}

#tips-screen h1#resurrection-countdown {
  font-family: 'Arial', sans-serif;
  font-size: 2em;
  color: white;
  background-color: #F7931A;
  padding: 10px 20px;
  border-radius: 10px;
  margin-top: 20px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

#tips-screen .content-block {
  background-color: #000000;
  padding: 40px;
  border-radius: 10px;
  text-align: center;
  min-width: 300px;
  max-width: 600px;
}

#tips-screen h2 {
  font-family: 'Arial', sans-serif;
  font-size: 2em;
  margin: 0 0 30px;
  color: white;
}

#tips-screen p {
  font-family: 'Arial', sans-serif;
  font-size: 1.5em;
  margin: 20px 0;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Last Life Screen (Unchanged per caveat) */
#last-life-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('images/gravebackground.jpg');
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 20;
}

#last-life-screen .content-block {
  background-color: rgba(0, 0, 0, 0.9);
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  min-width: 300px;
}

#last-life-screen h2 {
  font-size: 2em;
  margin: 0 0 25px;
  color: white;
}

#last-life-screen p {
  font-size: 1.2em;
  margin: 15px 0;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Settings Screen (Updated to overlay scaled canvas) */
#settings-screen {
  position: fixed; /* Changed to fixed to stay above canvas */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('images/standardbackground.jpg');
  background-size: cover;
  background-position: center;
  background-color: rgba(0, 0, 0, 0.7);
  background-blend-mode: overlay;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  z-index: 20;
  overflow-y: auto;
}

.settings-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 40px 20px;
  background-color: rgba(0, 0, 0, 0.9);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

#settings-back-button {
  position: absolute;
  top: 20px;
  left: 20px;
  padding: clamp(8px, 1.2vh, 12px) clamp(15px, 2.5vw, 25px);
  font-size: clamp(0.9em, 1.2vw, 1.1em);
  cursor: pointer;
  background-color: #fff;
  border: none;
  border-radius: 5px;
  color: #000;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

#settings-back-button:hover {
  background-color: #ddd;
}

.settings-content {
  padding: 80px 40px 40px 40px;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  font-family: 'Arial', sans-serif;
}

.settings-content h1 {
  font-size: 2.5em;
  margin: 0 0 40px;
  text-align: center;
  text-transform: uppercase;
}

/* Switch Container (Unchanged, used in both start and settings screens) */
.switch-container {
  display: flex;
  align-items: center;
  margin: clamp(30px, 4vw, 42px) 0;
  background-color: rgba(0, 0, 0, 0.5);
  padding: clamp(10px, 1.5vw, 15px);
  border-radius: 5px;
  justify-content: center;
  gap: 15px;
  z-index: 2;
  position: relative;
}

#start-screen .switch-container {
  background: linear-gradient(45deg, rgba(64, 43, 130, 0.9), rgba(105, 77, 191, 0.9), rgba(149, 128, 255, 0.9));
  border-radius: 10px;
  border: 2px solid #694dbf;
  width: clamp(150px, 30vw, 180px);
  padding: clamp(8px, 1.5vh, 10px) 0;
  margin: 0;
}

.switch-container label {
  font-size: clamp(0.8em, 1.2vw, 1em);
  color: #ffffff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  order: 1;
}

#start-screen .switch-container label {
  font-size: clamp(0.9em, 2.5vw, 1.1em);
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 27px;
  order: 2;
}

#start-screen .switch {
  width: 48px;
  height: 27px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 27px;
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.slider:before {
  position: absolute;
  content: "";
  height: 21px;
  width: 21px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #55ff55;
}

input:checked + .slider:before {
  transform: translateX(21px);
}

/* Instructions Screen (Unchanged per caveat) */
#instructions-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('images/standardbackground.jpg');
  background-size: cover;
  background-position: center;
  background-color: rgba(0, 0, 0, 0.7);
  background-blend-mode: overlay;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  z-index: 20;
  overflow-y: auto;
  padding: clamp(20px, 3vw, 30px);
  font-size: clamp(0.8em, 1vw, 1em);
}

.instructions-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 40px 20px;
  background-color: rgba(0, 0, 0, 0.9);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

#instructions-back-button {
  position: absolute;
  top: 20px;
  left: 20px;
  padding: 10px 20px;
  font-size: 1.2em;
  cursor: pointer;
  background-color: #fff;
  border: none;
  border-radius: 5px;
  color: #000;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

#instructions-back-button:hover {
  background-color: #ddd;
}

.instructions-content {
  padding: 80px 40px 40px 40px;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  font-family: 'Arial', sans-serif;
}

.instructions-content h1 {
  font-size: 2.5em;
  margin: 0 0 40px;
  text-align: center;
  text-transform: uppercase;
}

.instructions-content h2 {
  font-size: 2em;
  margin: 40px 0 20px;
  color: #ffcc00;
}

.instructions-content h3 {
  font-size: 1.5em;
  margin: 30px 0 15px;
  color: #55ff55;
}

.instructions-content h4 {
  font-size: 1.1em;
  margin: 20px 0 10px;
  color: #f7931a;
}

.instructions-content p {
  font-size: 1.0em;
  line-height: 1.4;
  margin: 0 0 20px;
  color: #ffffff;
}

/* Quick Guide Screen */
#quick-guide-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#quick-guide-screen .instructions-container {
  background-color: rgba(255, 255, 255, 0.95);
  padding: 30px;
  border-radius: 15px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

#quick-guide-screen .instructions-content {
  max-width: 600px;
  margin: 0 auto;
}

#quick-guide-screen h1 {
  color: #ff5555;
  text-align: center;
  margin-bottom: 30px;
  font-size: 2em;
}

#quick-guide-screen h2 {
  color: #ff5555;
  margin-top: 20px;
  font-size: 1.5em;
}

#quick-guide-screen ul {
  list-style-type: none;
  padding: 0;
  margin: 15px 0;
}

#quick-guide-screen li {
  padding: 8px 0;
  border-bottom: 1px solid #ddd;
}

#quick-guide-screen li:last-child {
  border-bottom: none;
}

#quick-guide-back-button {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 10px 20px;
  background-color: #ff5555;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease;
}

#quick-guide-back-button:hover {
  background-color: #dd3333;
}

/* Lore Screen */
#lore-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#lore-screen .instructions-container {
  background-color: rgba(0, 0, 0, 0.9);
  padding: 30px;
  border-radius: 15px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  display: inline-block;
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

#lore-screen .instructions-container::-webkit-scrollbar {
  display: none;  /* Chrome, Safari and Opera */
}

#lore-screen .instructions-content {
  padding: 80px 40px 40px 40px;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  font-family: 'Arial', sans-serif;
  text-align: left;
}

#lore-screen .instructions-content h1 {
  font-size: 2.5em;
  margin: 0 0 40px;
  text-align: left;
  text-transform: uppercase;
}

#lore-screen .instructions-content h2 {
  font-size: 2em;
  margin: 40px 0 20px;
  color: #ffcc00;
}

#lore-screen .instructions-content p {
  font-size: 1.0em;
  line-height: 1.4;
  margin: 0 0 20px;
  color: #ffffff;
}

#lore-back-button {
  position: absolute;
  top: 20px;
  left: 20px;
  padding: 10px 20px;
  font-size: 1.2em;
  cursor: pointer;
  background-color: #fff;
  border: none;
  border-radius: 5px;
  color: #000;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

#lore-back-button:hover {
  background-color: #ddd;
}

/* Hide scrollbar */
#lore-screen .instructions-content::-webkit-scrollbar {
  display: none;
}

#lore-screen .instructions-content {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Buff Active Animation (Unchanged) */
#scoreboard.buff-active {
  border: 2px solid #F7931A;
  animation: pulseGlowBlack 3s infinite ease-in-out;
}

@keyframes pulseGlowBlack {
  0% { box-shadow: 0 0 10px 5px rgba(50, 50, 50, 0.5); }
  50% { box-shadow: 0 0 20px 10px rgba(50, 50, 50, 0.8), 0 0 35px 15px rgba(50, 50, 50, 0.6); }
  100% { box-shadow: 0 0 10px 5px rgba(50, 50, 50, 0.5); }
}

/* Fullscreen Button */
#fullscreen-button {
  position: fixed;
  top: 10px;
  left: 10px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.2); /* 80% transparent white */
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  z-index: 1000;
  transition: background-color 0.3s ease;
  outline: none;
  pointer-events: auto;
}

#fullscreen-button:hover {
  background: rgba(255, 255, 255, 0.3);
}

#fullscreen-button:active {
  background: rgba(255, 255, 255, 0.2);
  opacity: 0.2;
}

#fullscreen-button img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  opacity: 0.3; /* 50% transparent */
}

/* Prevent focus styles */
#fullscreen-button:focus {
  outline: none;
  box-shadow: none;
}

/* Show end game button during game */
.game-screen #end-game-button {
  display: block !important;
}

/* Media Queries (Unchanged) */
@media (max-width: 600px) {
  .title-container {
    padding: 15px;
  }

  .title-container h1 {
    font-size: clamp(0.8em, 3.5vw, 1.2em);
    word-wrap: break-word;
  }

  .button-container {
    gap: 10px;
  }

  #byline {
    font-size: clamp(6px, 1vw, 10px);
    padding-bottom: 0.5vh;
  }
}

@media (max-height: 500px) {
  #start-screen {
    padding: 1vh 0;
  }

  .title-container {
    padding: 10px;
    margin-top: 15vh;
  }

  .button-container {
    gap: 8px;
    margin-top: 3vh;
  }

  .switch-container {
    width: clamp(120px, 25vw, 150px);
  }
}