:root {
  --clr-bg-light: #ffffff;
  --clr-bg-dark: #111827;
  --clr-text-light: rgb(82, 87, 96);
  --clr-text-dark: #d1d5db;
  --clr-card-light: #f9fafb;
  --clr-card-dark: rgba(31, 41, 55, 0.9);
  --clr-shadow-light: rgba(0, 0, 0, 0.1);
  --clr-shadow-dark: rgba(0, 0, 0, 0.7);
  --clr-primary: #111827;
  --clr-primary-hover: #2563eb;
  --clr-knob-bg: #111827; /* Default knob background (black) */
  --clr-knob-shadow: rgba(0, 0, 0, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background: var(--clr-bg-light);
  color: var(--clr-text-light);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  user-select: none;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body.dark {
  background: var(--clr-bg-dark);
  color: var(--clr-text-dark);
}

.hero {
  max-width: 1200px;
  margin: 2rem auto 0 auto;
  padding: 0 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.hero h1 {
  font-size: 3.2rem;
  margin: 0;
  font-weight: 700;
  line-height: 1.1;
  color: inherit;
}

.top-right-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Toggle switch container */
.toggle-switch {
  position: relative;
  width: 94px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

/* The slider bar */
.toggle-switch .slider {
  position: relative;
  background: var(--clr-card-light);
  border-radius: 34px;
  width: 100%;
  height: 100%;
  box-shadow: 0 4px 10px var(--clr-shadow-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--clr-primary);
  transition: background 0.3s ease, color 0.3s ease;
}

/* Dark Mode Toggle Switch Styles */
body.dark .toggle-switch .slider {
    background: var(--clr-card-dark); /* Darker background */
    box-shadow: 0 4px 10px var(--clr-shadow-dark); /* Darker shadow */
    color: var(--clr-text-dark); /* Lighter text */
}

.label {
  font-size: 0.75rem;
  color: var(--clr-primary);
}

body.dark .label {
  color: var(--clr-text-dark);
}

/* Knob */
.toggle-switch .knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 36px;
  height: 30px;
  background: var(--clr-knob-bg); /* Use the variable for the default (black) */
  border-radius: 50%;
  box-shadow: 0 2px 6px var(--clr-knob-shadow);
  transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: left;
}

/* Dark Mode Knob Style */
body.dark .toggle-switch .knob {
    left: 58px;
    background: #fff; /* White knob in dark mode */
    box-shadow: 0 2px 6px var(--clr-shadow-light); /* Lighter shadow for visibility */
}

.toggle-switch.active .slider {
  color: var(--clr-primary-hover);
}

/* Pause button */
.pause-btn {
  padding: 10px 24px;
  border-radius: 0.75rem;
  border: none;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--clr-shadow-light);
  transition: background-color 0.3s ease;
  color: var(--clr-primary);
  background: var(--clr-card-light);
  user-select: none;
  min-width: 120px;
}

.pause-btn:hover,
.pause-btn:focus {
  background: var(--clr-primary-hover);
  color: white;
  outline-offset: 2px;
  outline: 3px solid var(--clr-primary-hover);
}

body.dark .pause-btn {
  background: var(--clr-card-dark);
  color: #f9fafb;
  box-shadow: 0 4px 15px var(--clr-shadow-dark);
}

body.dark .pause-btn:hover,
body.dark .pause-btn:focus {
  background: var(--clr-primary-hover);
  color: white;
  outline: 3px solid var(--clr-primary-hover);
}

/* Layout container */
.container {
  max-width: 1200px;
  margin: 1.5rem auto 4rem auto;
  padding: 0 1.25rem;
  display: flex;
  gap: 2rem;
  min-height: 600px;
}

/* Speed controls */
#speed-controls {
  flex-shrink: 0;
  width: 170px;
  background: var(--clr-card-light);
  border-radius: 0.75rem;
  padding: 2rem 1.75rem;
  box-shadow: 0 12px 40px var(--clr-shadow-light);
  color: var(--clr-primary);
  display: flex;
  flex-direction: column;
  user-select: none;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

body.dark #speed-controls {
  background: var(--clr-card-dark);
  box-shadow: 0 12px 48px var(--clr-shadow-dark);
  color: #f9fafb;
}

#speed-controls h2 {
  margin-bottom: 1.5rem;
  font-weight: 600;
  font-size: 1.5rem;
  text-align: center;
}

.vertical-sliders {
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
}

.slider-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.slider-group label {
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  color: inherit;
}

/* Sliders */
input[type="range"] {
  width: 100%;
  height: 10px;
  background: #d1d5db;
  border-radius: 4px;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

body.dark input[type="range"] {
  background: #475569;
}

input[type="range"]:focus {
  outline: none;
  box-shadow: 0 0 6px var(--clr-primary-hover);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--clr-primary);
  border: none;
  cursor: pointer;
  margin-top: -9px;
  box-shadow: 0 0 12px var(--clr-primary);
  transition: background-color 0.3s ease;
}

body.dark input[type="range"]::-webkit-slider-thumb {
  background: #f9fafb;
}

input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:focus::-webkit-slider-thumb {
  background: var(--clr-primary-hover);
  box-shadow: 0 0 18px var(--clr-primary-hover);
}

/* Canvas container */
#canvas-container {
  flex-grow: 1;
  border-radius: 0.75rem;
  box-shadow: 0 15px 48px var(--clr-shadow-light);
  background: radial-gradient(circle at center, #f0f0f0 0%, #e5e5e5 95%);
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 480px;
}

body.dark #canvas-container {
  box-shadow: 0 15px 48px var(--clr-shadow-dark);
  background: radial-gradient(circle at center, #000814 0%, #00020a 95%);
}

/* Canvas */
canvas {
  border-radius: 0.75rem;
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Tooltip */
/* #tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(31, 41, 55, 0.9);
  color: #f9fafb;
  font-weight: 600;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 8px;
  user-select: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease;
  white-space: nowrap;
  z-index: 1000;
} */
 #tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 999;
}


/* Responsive */
@media (max-width: 900px) {
  .container {
    flex-direction: column;
    padding-bottom: 6rem;
  }

  #speed-controls {
    width: 100%;
    max-height: none;
    flex-direction: row;
    overflow-x: auto;
  }

  .vertical-sliders {
    flex-direction: row;
    gap: 1rem;
  }

  .slider-group {
    width: 100px;
  }

  #canvas-container {
  width: 100%;
  height: 100vh;
  display: block;
  position: relative;
  overflow: hidden;
}

}
