body {
  margin: 0;
  padding: 0;
  font-family: sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background-color 0.3s, color 0.3s;
}

body.dark {
  background-color: #111;
  color: white;
}
body.light {
  background-color: #f4f4f4;
  color: #222;
}

#container {
  display: grid;
  grid-template-columns: 20% 1fr 20%;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1600px;
  margin: 20px auto;
  gap: 20px;
}

#controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

.button-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.sliders {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  width: 100%;
  margin-top: 10px;
}

.sliders input[type="range"] {
  width: 90%;
}

#button-row-toggles {
  margin-top: 10px;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  text-align: center;
}

button {
  padding: 4px 8px;
  cursor: pointer;
  background-color: #444;
  color: white;
  border: none;
  border-radius: 4px;
  transition: background-color 0.2s;
}
button:hover {
  background-color: #666;
}
body.light button {
  background-color: #ccc;
  color: black;
}
body.light button:hover {
  background-color: #bbb;
}

#simArea {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#phaseWrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

#phaseCanvas {
  border: 1px solid #555;
  display: none;
  margin: 0 auto;
  width: 90%;
  height: auto;
  max-width: 300px;
}

canvas {
  border: 1px solid #555;
  margin-top: 10px;
}

#energyDisplay {
  position: absolute;
  top: 15px;
  right: 15px;
  margin: 0;
  padding: 4px 8px;
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  border-radius: 4px;
  font-size: 14px;
  font-weight: bold;
  pointer-events: none;
}
body.light #energyDisplay {
  background-color: rgba(255, 255, 255, 0.8);
  color: black;
}

canvas#glcanvas {
  width: 100%;
  height: auto;
  display: block;
}
