/* Full-screen layout */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  font-family: 'Roboto', sans-serif;
  color: #FFF;
}

/* Wrap the canvas so we can scale the entire simulation if desired */
#simCanvasWrapper {
  width: 100%;
  height: 100%;
  /* Default scale for desktop */
  transform: scale(1.0);
  transform-origin: center center;
}

/* The canvas inside the wrapper */
canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

/* Panels for controls + time & leaderboards */
.control-panel,
.time-panel {
  position: absolute;
  padding: 8px;
  user-select: none;
  z-index: 2;
  border: 1px solid #555;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
  background: linear-gradient(135deg, rgba(20,0,40,0.8), rgba(0,0,0,0.6));
}

/* widths: make both 420px for desktop */
.control-panel {
  width: 420px;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
}
.time-panel {
  width: 420px;
  left: 50%;
  top: 20px;
  transform: translateX(-50%);
  text-align: center;
}

/* Panel headers */
.control-panel .header,
.time-panel .header {
  font-weight: bold;
  padding: 6px;
  background: rgba(0,0,0,0.8);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 5px;
  box-shadow: inset 0 0 5px rgba(255,0,255,0.2);
}

/* Panel content */
.control-panel .content,
.time-panel .content {
  margin-top: 8px;
  font-size: 14px;
}

/* Buttons in panels */
.control-panel button,
.time-panel button {
  background: #444;
  border: none;
  color: #FFF;
  cursor: pointer;
  padding: 4px 8px;
  font-weight: bold;
  border-radius: 4px;
}
.control-panel button:hover,
.time-panel button:hover {
  background: #666;
}

/* Control panel styling */
.control-group {
  margin-bottom: 10px;
  text-align: left;
}
.control-group label {
  display: inline-block;
  width: 150px;
  font-weight: bold;
}
.control-group input[type=range] {
  width: 200px;
}
.control-buttons {
  text-align: center;
  margin-top: 10px;
}
.control-buttons button {
  margin: 0 5px;
  padding: 6px 12px;
  background: linear-gradient(90deg, #8000ff 0%, #ff00ff 100%);
  border: none;
  color: #FFF;
  cursor: pointer;
  font-weight: bold;
  border-radius: 4px;
  box-shadow: 0 0 5px rgba(255,0,255,0.4);
}
.control-buttons button:hover {
  opacity: 0.8;
}

/* Main tab styling */
.top-level-tabs {
  display: flex;
  margin-bottom: 10px;
}
.top-level-tabs .tabBtn {
  flex: 1;
  margin: 0 2px;
  background: #444;
  border: none;
  color: #FFF;
  cursor: pointer;
  padding: 4px 8px;
  font-weight: bold;
  border-radius: 4px;
}
.top-level-tabs .tabBtn.active {
  background: linear-gradient(90deg, #8000ff 0%, #ff00ff 100%);
  box-shadow: 0 0 5px rgba(255,0,255,0.4);
}

/* Sub-tab styling for Reward sub-tabs */
.reward-subtabs {
  display: flex;
  margin-bottom: 10px;
}
.reward-subtabs .tabBtn {
  flex: 1;
  margin: 0 2px;
  background: #444;
  border: none;
  color: #FFF;
  cursor: pointer;
  padding: 4px 8px;
  font-weight: bold;
  border-radius: 4px;
}
.reward-subtabs .tabBtn.active {
  background: linear-gradient(90deg, #8000ff 0%, #ff00ff 100%);
  box-shadow: 0 0 5px rgba(255,0,255,0.4);
}
.reward-sub-content {
  display: none; /* hidden by default */
}
.reward-sub-content.active {
  display: block;
}

/* Sub-tabs for Snakes */
.snakes-subtabs {
  display: flex;
  margin-bottom: 10px;
}
.snakes-subtabs .tabBtn {
  flex: 1;
  margin: 0 2px;
  background: #444;
  border: none;
  color: #FFF;
  cursor: pointer;
  padding: 4px 8px;
  font-weight: bold;
  border-radius: 4px;
}
.snakes-subtabs .tabBtn.active {
  background: linear-gradient(90deg, #8000ff 0%, #ff00ff 100%);
  box-shadow: 0 0 5px rgba(255,0,255,0.4);
}
.snakes-sub-content {
  display: none;
}
.snakes-sub-content.active {
  display: block;
}

/* Sub-tabs for 'World' (Environment + Evolution) */
.world-subtabs {
  display: flex;
  margin-bottom: 10px;
}
.world-subtabs .tabBtn {
  flex: 1;
  margin: 0 2px;
  background: #444;
  border: none;
  color: #FFF;
  cursor: pointer;
  padding: 4px 8px;
  font-weight: bold;
  border-radius: 4px;
}
.world-subtabs .tabBtn.active {
  background: linear-gradient(90deg, #8000ff 0%, #ff00ff 100%);
  box-shadow: 0 0 5px rgba(255,0,255,0.4);
}
.world-sub-content {
  display: none;
}
.world-sub-content.active {
  display: block;
}

/* .tab-content is used for top-level content areas */
.tab-content {
  display: none; /* hidden by default */
}
.tab-content.active {
  display: block;
}

/* Basic text styling for descriptions */
.tab-description {
  font-size: 13px;
  font-style: italic;
  margin-bottom: 10px;
  opacity: 0.9;
}
.setting-description {
  font-size: 12px;
  font-style: italic;
  margin-top: 4px;
  opacity: 0.8;
}

/* Leaderboard styling */
.leaderboard-text {
  font-size: 12px;
  line-height: 1.2;
  word-break: break-word; /* allow word wrapping */
}

/* Loading overlay for fast-forward */
#loadingOverlay {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  color: #FFF;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  text-align: center;
}
@keyframes sinewave {
  0% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-20px); }
  100% { transform: translateX(-50%) translateY(0); }
}
#loadingOverlay .sinewave {
  font-size: 24px;
  animation: sinewave 1s infinite;
}

/* Help Button style (no longer absolutely positioned) */
.help-button {
  margin-left: 8px;
  background: #444;
  border: 1px solid #555;
  color: #FFF;
  font-size: 14px;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(255,0,255,0.5);
}
.help-button:hover {
  background: #667;
}

/* Help Modal Overlay */
.help-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: none;
  z-index: 9999;
  align-items: center;
  justify-content: center; /* center horizontally */
}

/* Help Modal Content */
.help-content {
  position: relative;
  width: 400px;
  max-width: 90%;
  padding: 16px;
  border: 1px solid #555;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(20,0,40,0.9), rgba(0,0,0,0.7));
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.4);
  text-align: left;
}

/* Close button inside modal */
.help-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: none;
  color: #FFF;
  font-size: 18px;
  cursor: pointer;
}
.help-close:hover {
  color: #ff00ff;
}

/* Mobile-friendly adjustments */
@media (max-width: 1000px) {
  .control-panel {
    width: 90%;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
  }
  .time-panel {
    width: 90%;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
  }

  /* Stack the leaderboards vertically in mobile to avoid overflow */
  .leaderboardColumn {
    width: 100% !important;
    margin-bottom: 10px;
    padding-left: 0 !important;
  }
}
