html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none; /* Disable browser's default touch actions */
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
}

#background-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  touch-action: none; /* Prevent default touch behaviors */
}

canvas {
    display: block;
}

/* Player HUD Styles */
#player-hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: auto; /* Allow dynamic height */
  background-color: #000000; /* Black background for retro feel */
  color: #00FF00; /* Neon green text */
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 10px 20px 30px; /* Added extra padding at the bottom */
  z-index: 100;
  font-family: 'Verdana', sans-serif; /* Thicker and more readable font */
  font-size: 12px; /* Keep text small */
  font-weight: bold; /* Thicker font for better readability */
  line-height: 1.5; /* Improved line spacing for readability */
  box-shadow: 0 4px 8px rgba(0, 255, 0, 0.2); /* Green glow effect */
  border-bottom: 2px solid #00FF00; /* Neon green border at the bottom */
}

.hud-section {
  display: flex;
  align-items: center;
}

.label {
  font-weight: bold;
  margin-right: 8px;
  color: #FFFF00; /* Yellow color for labels */
}

.stock-item {
  margin-right: 10px;
  display: inline-flex;
  align-items: center;
}

/* Timer styles */
.timer-fresh {
  color: #4CAF50; /* Green */
  transition: color 0.3s, font-size 0.3s;
}

.timer-warning {
  color: #FF9800; /* Orange */
  transition: color 0.3s, font-size 0.3s;
}

.timer-critical {
  color: #F44336; /* Red */
  font-size: 18px; /* Larger font size */
  font-weight: bold;
  transition: color 0.3s, font-size 0.3s;
}

/* New blinking animation for timer at zero */
@keyframes blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
  100% { opacity: 1; }
}

.timer-zero {
  color: #F44336; /* Red */
  font-size: 18px; /* Larger font size */
  font-weight: bold;
  animation: blink 1s infinite; /* Apply blinking animation */
}

/* Bidding UI Styles */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 60%; /* Make slider control even shorter (was 80%) */
  background: transparent;
  margin: 0 auto; /* Center the slider */
  display: block; /* Add this for proper centering */
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #4CAF50;
  cursor: pointer;
  margin-top: -8px;
}

input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 5px;
  cursor: pointer;
  background: #555;
  border-radius: 2px;
}

input[type=range]:focus {
  outline: none;
}

input[type=range]::-moz-range-thumb {
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #4CAF50;
  cursor: pointer;
}

input[type=range]::-moz-range-track {
  width: 100%;
  height: 5px;
  cursor: pointer;
  background: #555;
  border-radius: 2px;
}

.bid-interface {
  margin-top: 15px;
  padding: 15px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-sizing: border-box;
  width: auto !important; /* Override any inline width */
  overflow: visible;
}

/* Room popup styles */
#room-popup {
  box-sizing: border-box;
  overflow: visible !important;
}

#room-popup * {
  box-sizing: border-box;
  max-width: 100%;
}

/* Active bids indicator styles */
.bids-section {
  transition: color 0.3s ease;
}

/* Floating player list window styles */
.floating-window {
  position: absolute;
  top: calc(5px + var(--player-hud-height, 0px)); /* Positioned 5px below the player HUD */
  left: 10px;
  width: 300px; /* Reduced width */
  background-color: #000000; /* Black background for retro feel */
  border: 2px solid #00FF00; /* Neon green border */
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 255, 0, 0.2); /* Green glow effect */
  overflow-x: hidden; /* Prevent horizontal scroll bars */
  overflow-y: auto; /* Allow vertical scrolling if needed */
  z-index: 1000;
  font-family: 'Verdana', sans-serif; /* Thicker and more readable font */
  font-size: 10px; /* Smaller font size */
  font-weight: bold; /* Thicker font for better readability */
  line-height: 1.5; /* Improved line spacing for readability */
  transition: height 0.3s ease;
}

.floating-window.minimized {
  height: 30px;
  overflow: hidden;
}

.floating-window-title {
  background-color: #111111; /* Darker black for contrast */
  padding: 10px;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
  border-bottom: 2px solid #00FF00; /* Neon green border */
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #00FF00; /* Neon green text */
}

.floating-window-title .toggle-icon {
  font-size: 14px;
  margin-left: 10px;
}

.floating-window-content {
  padding: 15px; /* Increased padding for better spacing */
  max-height: 400px;
  overflow-y: auto;
}

.player-list-header {
  font-weight: bold;
  margin-bottom: 10px;
}

.player-list {
  width: 100%;
  border-collapse: collapse;
}

.player-list th, .player-list td {
  text-align: left;
  padding: 8px; /* Increased padding for better spacing */
  color: #00FF00; /* Neon green text */
  border-bottom: 1px solid #00FF00; /* Neon green row separator */
  font-size: 10px; /* Smaller font size for table content */
}

.player-list th {
  background-color: #222222; /* Slightly lighter black for header */
  font-weight: bold;
}

.player-list td {
  border-bottom: 1px solid #00FF00; /* Neon green row separator */
}

.player-list .player-money {
  text-align: left; /* Align money values to the left, consistent with other columns */
  font-weight: bold; /* Highlight money values */
}

.player-list tr:last-child td {
  border-bottom: none;
}

/* Help button styles */
#help-button {
  position: fixed;
  bottom: 10px;
  left: 10px;
  width: 30px;
  height: 30px;
  background-color: #000000; /* Black background for retro feel */
  color: #00FF00; /* Neon green text */
  font-family: 'Verdana', sans-serif;
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  line-height: 30px;
  border: 2px solid #00FF00; /* Neon green border */
  border-radius: 50%;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 8px rgba(0, 255, 0, 0.2); /* Green glow effect */
}

/* Help window styles */
#help-window {
  position: fixed;
  bottom: 50px;
  left: 10px;
  width: 300px; /* Match leaderboard width */
  background-color: #000000; /* Black background for retro feel */
  border: 2px solid #00FF00; /* Neon green border */
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 255, 0, 0.2); /* Green glow effect */
  color: #00FF00; /* Neon green text */
  font-family: 'Verdana', sans-serif;
  font-size: 10px; /* Match leaderboard font size */
  font-weight: bold;
  line-height: 1.5;
  padding: 15px;
  z-index: 1000;
  display: none; /* Hidden by default */
}

#help-window.visible {
  display: block; /* Show when visible */
}

.help-close-button {
  text-align: right;
  cursor: pointer;
  color: #00FF00; /* Neon green text */
  font-size: 10px; /* Match leaderboard font size */
  margin-bottom: 10px;
}

.help-content {
  font-size: 10px; /* Match leaderboard font size */
  line-height: 1.5;
}

/* Responsive adjustments for small screens */
@media (max-width: 768px) {
  #player-hud {
    flex-wrap: wrap;
    height: auto;
    padding: 10px;
  }
  
  .hud-section {
    margin: 5px 10px;
  }
  
  .stocks-section {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  #player-hud {
    font-size: 12px; /* Smaller font on mobile */
  }
  
  .bids-section {
    order: 2; /* Move bids section below username/money for better layout */
  }

  :root {
    --player-hud-height: auto; /* Allow the height to adjust dynamically */
  }
}

/* Add a CSS variable to track the height of the player HUD */
:root {
  --player-hud-height: 50px; /* Default height of the player HUD */
}
