body {
  margin: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #1a2a3a 0%, #0a151f 100%); /* Darker, more professional gradient */
  font-family: 'Montserrat', sans-serif; /* Modern sans-serif font */
  color: white;
}

canvas {
  width: 100vw;
  height: 100vh;
}

.controls {
  position: fixed;
  top: 20px;
  left: 20px;
  color: white;
  background: rgba(0, 0, 0, 0.6); /* Slightly more opaque */
  padding: 10px 15px;
  border-radius: 8px; /* More rounded */
  font-size: 0.95em; /* Slightly smaller text */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

.controls p {
  margin: 5px 0;
}

.menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 20, 30, 0.95); /* Slightly transparent for background canvas */
  color: white;
  z-index: 100;
  gap: 30px;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
  border: 1px solid #3498db; /* Subtle border */
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6); /* Deeper shadow */
  border-radius: 15px; /* More rounded corners */
  max-width: 90%; /* Max width for better responsiveness */
  max-height: 90%; /* Max height for better responsiveness */
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.menu h1 {
  font-family: 'Orbitron', sans-serif; /* Distinct font for main title */
  font-size: 4em; /* Larger title */
  margin-bottom: 0;
  text-shadow: 0 0 15px rgba(97, 218, 251, 0.7); /* Brighter glow */
  color: #61dafb; /* Brighter blue */
}

.menu h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 2em;
  color: #61dafb;
  text-shadow: 0 0 8px rgba(97, 218, 251, 0.5);
  margin-top: 20px;
  margin-bottom: 20px;
}

.menu-button {
  padding: 18px 35px; /* Larger padding */
  font-size: 1.3em; /* Larger text */
  background: linear-gradient(45deg, #e74c3c, #c0392b); /* Gradient background */
  border: none;
  border-radius: 10px; /* More rounded */
  color: white;
  cursor: pointer;
  transition: all 0.2s ease-out; /* Smoother transition */
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4); /* Deeper shadow */
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
}

.menu-button:hover {
  transform: translateY(-5px); /* More noticeable lift */
  background: linear-gradient(45deg, #c0392b, #a93226);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.menu-button:active {
  transform: translateY(-2px); /* Pressed effect */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

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

.game {
  width: 100vw;
  height: 100vh;
}

.hidden {
  display: none;
}

.spawn-menu-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(45deg, #3498db, #2980b9); /* Gradient background */
  color: white;
  border: none;
  padding: 12px 22px; /* Adjusted padding */
  border-radius: 10px; /* More rounded */
  cursor: pointer;
  font-size: 1.1em;
  z-index: 1000;
  transition: all 0.2s ease-out; /* Smoother transition */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.spawn-menu-toggle:hover {
  background: linear-gradient(45deg, #2980b9, #2374a5);
  transform: translateY(-3px); /* More noticeable lift */
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.spawn-menu-toggle:active {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.spawn-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  background: rgba(10, 20, 30, 0.95); /* Consistent with menu background */
  padding: 0;
  color: white;
  z-index: 999;
  overflow-y: auto;
  box-shadow: -8px 0 25px rgba(0, 0, 0, 0.6); /* Deeper shadow */
  transition: transform 0.3s ease-in-out;
  border-left: 1px solid #3498db; /* Subtle border */
}

.spawn-menu.hidden {
  transform: translateX(100%);
}

.spawn-menu-header {
  background: #0a151f; /* Darker header background */
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #61dafb; /* Brighter accent */
}

.spawn-menu-header h3 {
  margin: 0;
  color: #61dafb;
  font-size: 1.6em; /* Slightly larger */
  font-family: 'Orbitron', sans-serif;
}

.spawn-menu-section {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.spawn-menu-section h4 {
  margin: 0 0 15px 0;
  color: #61dafb; /* Brighter accent */
  font-size: 1.3em; /* Slightly larger */
}

.preset-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px; /* Slightly larger gap */
}

.ragdoll-preset,
.object-preset,
.weapon-preset,
.map-button,
.softbody-preset,
.syringe-preset,
.liquid-preset { /* Add .syringe-preset here to apply general button styles */
  background: rgba(255, 255, 255, 0.08); /* More subtle background */
  border: 1px solid rgba(255, 255, 255, 0.1); /* Subtle border */
  color: white;
  padding: 15px;
  border-radius: 10px; /* More rounded */
  cursor: pointer;
  transition: all 0.2s ease-out; /* Smoother transition */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  font-size: 0.9em;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.ragdoll-preset:hover,
.object-preset:hover,
.weapon-preset:hover,
.map-button:hover,
.softbody-preset:hover,
.syringe-preset:hover,
.liquid-preset:hover { /* Add .syringe-preset here for hover styles */
  background: rgba(255, 255, 255, 0.15); /* More noticeable hover */
  transform: translateY(-3px); /* More noticeable lift */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.ragdoll-preset::after {
  content: attr(data-specialty);
  display: block;
  font-size: 0.65em; /* Slightly smaller */
  color: #61dafb; /* Consistent color */
  margin-top: 5px;
  opacity: 0.8; /* More visible */
}

.preset-icon {
  width: 24px; /* Larger icon */
  height: 24px; /* Larger icon */
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2); /* Add border to icons */
}

.object-preset .preset-icon {
  border-radius: 6px; /* Slightly more rounded */
}

.weapon-preset .preset-icon {
  border-radius: 3px;
  width: 30px; /* Larger weapon icon */
  height: 10px; /* Larger weapon icon */
}

/* Softbody icons will use .preset-icon and adjust border-radius via inline style based on shape */
.softbody-preset .preset-icon {
  width: 28px; /* Slightly larger icon for softbodies */
  height: 28px; /* Slightly larger icon for softbodies */
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.weapon {
  position: absolute;
  pointer-events: none;
  z-index: 2;
}

.weapon-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.6); /* Consistent background */
  padding: 10px 15px;
  border-radius: 8px; /* Rounded corners */
  color: white;
  font-size: 1em;
  z-index: 1000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  font-family: 'Montserrat', sans-serif;
}

.health-bar {
  position: absolute;
  width: 50px;
  height: 8px;
  border: 2px solid;
  border-radius: 4px;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}

.health-bar-fill {
  height: 100%;
  width: 100%;
  background: #2ecc71;
  transition: width 0.3s, background 0.3s;
}

.health-text {
  position: absolute;
  color: white;
  font-size: 15px; /* Slightly larger */
  font-weight: bold;
  font-family: 'Orbitron', sans-serif; /* Distinct font */
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; /* Text stroke for better readability */
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.3s ease-out;
}

.health-text.dying {
  opacity: 0;
}

.ragdoll-health-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, rgba(26, 42, 58, 0.98), rgba(10, 21, 31, 0.98)); /* Darker, more refined gradient */
  padding: 30px; /* More padding */
  border-radius: 18px; /* More rounded */
  color: white;
  z-index: 1001;
  max-width: 450px; /* Slightly wider */
  max-height: 85vh; /* Taller */
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8); /* Deeper shadow */
  display: flex;
  flex-direction: column;
  border: 2px solid #61dafb; /* Accent border */
}

.ragdoll-health-overlay h3 {
  margin-top: 0;
  color: #61dafb; /* Brighter accent */
  font-size: 2em; /* Larger title */
  font-family: 'Orbitron', sans-serif;
  border-bottom: 1px solid rgba(97, 218, 251, 0.2); /* Accent border */
  padding-bottom: 15px; /* More padding */
  margin-bottom: 25px; /* More margin */
}

.ragdoll-health-overlay ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ragdoll-health-overlay li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0; /* More padding */
  border-bottom: 1px solid rgba(97, 218, 251, 0.1); /* Accent border */
  font-size: 1.05em;
}

.ragdoll-health-overlay li:last-child {
  border-bottom: none;
}

.ragdoll-health-overlay .ragdoll-id {
  font-size: 1em;
  color: #ccc;
  font-weight: bold;
}

.ragdoll-health-overlay .ragdoll-health-value {
  font-size: 1.3em; /* Larger health value */
  font-weight: bold;
}

.ragdoll-health-overlay .close-overlay-btn {
  margin-top: 30px; /* More margin */
  padding: 12px 25px; /* Larger padding */
  background: linear-gradient(45deg, #e74c3c, #c0392b); /* Gradient button */
  color: white;
  border: none;
  border-radius: 8px; /* Rounded corners */
  cursor: pointer;
  font-size: 1.15em; /* Larger text */
  align-self: flex-end;
  transition: all 0.2s ease-out;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.ragdoll-health-overlay .close-overlay-btn:hover {
  background: linear-gradient(45deg, #c0392b, #a93226);
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.ragdoll-health-overlay .close-overlay-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#mapSelectionScreen h2 {
  font-size: 1.8em; /* Consistent with character creator h2 */
  margin-bottom: 20px;
}

.map-preview-container {
  width: 80%; /* Adjust width as needed */
  max-width: 400px; /* Max width for consistency */
  height: 200px; /* Fixed height for the preview area */
  margin-bottom: 20px;
  border: 2px solid #61dafb; /* Border similar to menu */
  border-radius: 10px;
  overflow: hidden; /* Ensure image doesn't overflow */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  background-color: #0a151f; /* Dark background for empty state */
  display: flex;
  justify-content: center;
  align-items: center;
}

.map-preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Cover the container, cropping if necessary */
  display: block; /* Remove extra space below image */
  transition: opacity 0.3s ease-in-out;
  opacity: 1; /* Changed from 0.9 to 1 to ensure full visibility */
}

.map-buttons-container {
  display: grid; /* Changed to grid for better control over button layout */
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Responsive grid */
  gap: 12px; /* Slightly larger gap */
  width: 100%;
  max-width: 800px; /* Wider for more columns */
  justify-content: center; /* Center buttons within container */
}

.map-buttons-container .map-button {
  width: auto; /* Let grid handle width */
  padding: 18px; /* Larger padding */
  font-size: 1.2em; /* Larger text */
  background: linear-gradient(45deg, #3498db, #2980b9); /* Gradient button */
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease-out;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.map-buttons-container .map-button:hover {
  background: linear-gradient(45deg, #2980b9, #2374a5);
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.map-buttons-container .map-button:active {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.map-buttons-container .map-button.selected {
  border: 3px solid #2ecc71; /* Green border for selected map */
  box-shadow: 0 0 15px rgba(46, 204, 113, 0.8), inset 0 0 10px rgba(46, 204, 113, 0.4);
  background: linear-gradient(45deg, #2ecc71, #27ae60); /* Slightly greener gradient background */
  transform: translateY(-2px); /* Keep slightly lifted */
}

.map-buttons-container .map-button.selected:hover {
  transform: translateY(-4px); /* Even more lift on hover for selected */
  box-shadow: 0 0 20px rgba(46, 204, 113, 0.9), inset 0 0 12px rgba(46, 204, 113, 0.5);
}

.menu-back-button {
  padding: 12px 25px; /* Larger padding */
  font-size: 1.1em; /* Larger text */
  background: #7f8c8d;
  border: none;
  border-radius: 8px; /* Rounded corners */
  color: white;
  cursor: pointer;
  transition: all 0.2s ease-out;
  margin-top: 20px; /* More margin */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.menu-back-button:hover {
  background: #626a6d;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.menu-back-button:active {
  transform: translateY(-1px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px); /* More pronounced slide */
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Apply animation to relevant elements if desired, e.g., menu content */
.menu h1, .menu-button, .map-buttons-container {
  animation: slideDown 0.5s ease-out forwards;
}

/* Delay for subsequent elements */
.menu-button { animation-delay: 0.1s; }
.map-buttons-container { animation-delay: 0.2s; }

.info-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #1a2a3a 0%, #0a151f 100%); /* Darker, more professional gradient */
  color: white;
  padding: 30px 40px; /* More padding */
  border-radius: 15px; /* More rounded */
  text-align: center;
  font-size: 1.2em;
  font-family: 'Montserrat', sans-serif;
  box-shadow: 0 0 30px rgba(97, 218, 251, 0.8), 0 0 15px rgba(0,0,0,0.5) inset; /* Enhanced glow and inner shadow */
  border: 2px solid #61dafb; /* Bright blue border */
  z-index: 1000;
  max-width: 80%;
  display: flex; /* Use flexbox for layout */
  flex-direction: column; /* Stack children vertically */
  align-items: center; /* Center items horizontally */
  gap: 20px; /* Space between text and button */
  opacity: 0; /* Start hidden for controlled display */
  transition: opacity 0.3s ease-in-out; /* Smooth fade-in/out */
}

.info-message.show {
  opacity: 1; /* Show the message */
}

.info-message.hidden {
  display: none;
}

.info-message p {
  margin: 0; /* Remove default paragraph margin */
  line-height: 1.5;
}

.info-message-button {
  padding: 12px 25px;
  font-size: 1.1em;
  background: linear-gradient(45deg, #2ecc71, #27ae60); /* Green gradient for OK button */
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease-out;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  text-transform: uppercase;
  font-weight: bold;
}

.info-message-button:hover {
  transform: translateY(-3px);
  background: linear-gradient(45deg, #27ae60, #229a5f);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.info-message-button:active {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* New style for action buttons in spawn menu */
.spawn-action-button {
  width: 100%; /* Make them full width of their container */
  padding: 15px 20px;
  font-size: 1.1em;
  background: linear-gradient(45deg, #8e44ad, #9b59b6); /* Purple gradient */
  border: none;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease-out;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  text-transform: uppercase;
  font-weight: bold;
  display: flex; /* Use flexbox for icon and text */
  align-items: center;
  justify-content: center;
  gap: 10px; /* Space between icon and text */
}

.spawn-action-button:hover {
  transform: translateY(-3px);
  background: linear-gradient(45deg, #9b59b6, #8e44ad); /* Inverted gradient on hover */
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.spawn-action-button:active {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.spawn-action-button .icon {
  font-size: 1.2em; /* Slightly larger icon */
}