body {
  margin: 0;
  overflow: hidden;
  /* Hide scrollbars */
  background-color: #f0f0f0;
  font-family: sans-serif;
}

canvas {
  display: block;
  /* Removes tiny margin at bottom of canvas */
}

#loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  color: #333;
  pointer-events: none;
}

/* Container for all playback controls */
#controlsContainer {
  position: absolute;
  bottom: 20px;
  right: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 10;
}

/* Play/Pause Button */
#playPauseBtn {
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#playPauseBtn:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

/* Pause symbol - two vertical bars */
#playPauseBtn.pause {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

#playPauseBtn.pause::before,
#playPauseBtn.pause::after {
  content: '';
  width: 6px;
  height: 20px;
  background-color: white;
  border-radius: 1px;
}

/* Play symbol - arrow pointing right */
#playPauseBtn.play {
  display: flex;
  justify-content: center;
  align-items: center;
}

#playPauseBtn.play::before {
  content: '';
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 16px solid white;
  margin-left: 4px;
}

/* Step Forward and Backward Buttons */
.step-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
  pointer-events: none; /* Make unclickable when hidden */
  transform: scale(0.8);
  display: flex;
  justify-content: center;
  align-items: center;
}

.step-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.step-btn:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

/* Step Forward Symbol (>|) */
#stepForwardBtn::before {
  content: '';
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid white;
  margin-left: 2px;
}

#stepForwardBtn::after {
  content: '';
  width: 3px;
  height: 12px;
  background-color: white;
  margin-left: 3px;
  border-radius: 1px;
}

/* Step Backward Symbol (|<) */
#stepBackwardBtn::before {
  content: '';
  width: 3px;
  height: 12px;
  background-color: white;
  margin-right: 3px;
  border-radius: 1px;
}

#stepBackwardBtn::after {
  content: '';
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 10px solid white;
  margin-right: 2px;
}

/* Speed controls */

#speedControlWrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin-bottom: 15px;
}

#speedToggleBtn {
  background: none;
  border: none;
  color: #1a1a1a;
  cursor: pointer;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s ease;
}

#speedToggleBtn:hover {
  transform: scale(1.1);
}

#speedMenu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  opacity: 0;
  pointer-events: none; /* Make unclickable when hidden */
  transform: translateY(10px) scale(0.95);
  transition: all 0.2s ease;
  transform-origin: bottom center;
}

#speedMenu.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.speed-option {
  background-color: #dcdcdc;
  border: none;
  border-radius: 20px;
  padding: 10px 10px;
  font-size: 1.2rem;
  font-family: inherit;
  color: #000;
  cursor: pointer;
  /* min-width: 90px; */
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  transition: background-color 0.2s ease, transform 0.1s ease;
  line-height: 1.2;
}

.speed-option:active {
  transform: scale(0.95);
}

.speed-option.active {
  background-color: #9df09b;
}

.speed-label-normal {
  font-size: 0.9rem;
  font-weight: normal;
}