/* ==== Base Page Styling ==== */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #0e0e0e;
  color: white;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.wrapper {
  background: #1b1b1b;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.15);
  max-width: 1400px;   /* give it more horizontal space */
  width: 95%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}


h1, h4 {
  color: white;
  margin: 5px 0;
}

/* ==== Layout: Controls + Equation ==== */
#mainControl {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: stretch;
  gap: 40px;
  margin-top: 20px;
  width: 100%;
  max-width: 900px;
}

/* ==== Panels ==== */
#controls, #params {
  background-color: black;
  color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.1);
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* ==== Controls Panel ==== */
#controls label {
  margin-top: 5px;
}

#controls input[type="range"] {
  width: 180px;
  cursor: pointer;
  margin-bottom: 8px;
}

#preset {
  margin-top: 10px;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #333;
  background-color: #111;
  color: white;
}

#color-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  align-items: center;
}

#color-controls input[type="color"] {
  cursor: pointer;
  width: 50px;
  height: 30px;
  border: none;
  border-radius: 4px;
}


#reset-btn {
  background-color: rgb(56, 134, 104);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  margin-top: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s ease;
}



#reset-btn:hover {
  background-color: rgb(72, 174, 134);
}

/* ==== Equation Panel ==== */
#param-title {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 10px;
  color: white;
}

#params {
  text-align: center;
  justify-content: center;
  align-items: center;
}

#params p {
  font-size: 18px;
  margin: 0;
  line-height: 1.8em;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 160px; /* keeps math centered vertically */
}

#params .MathJax {
  margin: auto !important;
}

/* ==== Canvas ==== */
/* ==== Canvas Container ==== */
#canvas-container {
  margin-top: 40px;
  background: black;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 0 25px rgba(0, 255, 255, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  aspect-ratio: 1 / 1;      /* 🔥 enforce square container */
}

/* ==== Canvas ==== */
#canvas2d {
  display: block;
  width: 100%;
  height: 100%;             /* 🔥 fill square container exactly */
  border: 1px solid #333;
  border-radius: 8px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}







/* ==== Tip ==== */
#tip {
  background-color: black;
  color: white;
  font-weight: bold;
  font-family: Arial, Helvetica, sans-serif;
  border-radius: 5px;
  padding: 10px 15px;
  margin-top: 20px;
}

/* ==== Back Button ==== */
.back-button {
  position: absolute;
  top: 20px;
  left: 20px;
  background-color: black;
  color: white;
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

.back-button:hover {
  background-color: #333;
}

/* ==== Responsive ==== */
@media (max-width: 700px) {
  #mainControl {
    flex-direction: column;
    align-items: center;
  }

  #controls, #params {
    width: 100%;
  }

  #canvas2d {
    width: 90vw;
    height: 90vw;
  }

  #params p {
    min-height: auto;
    transform: scale(1.05);
  }
}
