/* Common stylesheet for math visualization toys */

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 10px;
  background: #f8f9fa;
  color: #333;
  line-height: 1.6;
  font-size: 16px;
  -webkit-text-size-adjust: none;
  height: 100vh;
  overflow: hidden;
}

.container {
  max-width: 100%;
  height: 100vh;
  margin: 0 auto;
  background: white;
  padding: 20px;
  border-radius: 4px;
}

h1 {
  margin: 0 0 20px 0;
  color: #2c3e50;
  font-weight: 600;
  text-align: center;
}

.controls {
  background: #f8f9fa;
  padding: 10px 20px 10px 20px;
  border-radius: 4px;
  margin-bottom: 10px;
  border: 1px solid #3498db;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.control-group {
  display: flex;
  margin: 5px 10px;
  align-items: center;
}

label {
  display: inline-block;
  font-weight: 500;
  margin-right: 8px;
  color: #555;
}

.slider {
  width: 150px;
  height: 4px;
  border-radius: 2px;
  background: #ddd;
  outline: none;
  margin-right: 2px;
  appearance: none;
}

.slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3498db;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3498db;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  border: none;
}

/* Value display spans */
span {
  display: inline-block;
  min-width: 2.5em;
  text-align: right;
  font-weight: 500;
  color: #3498db;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-left: 8px;
  accent-color: #3498db;
}

.button, button {
  background: #3498db;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.button:hover, button:hover {
  background: #2980b9;
}

input[type="text"], input[type="number"] {
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  transition: border-color 0.2s;
  text-align: right;
  width: 5em;
}

input[type="text"]:focus, input[type="number"]:focus {
  outline: none;
  border-color: #3498db;
}

/* Hide number input stepper arrows */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* Firefox */
input[type="number"] {
  -moz-appearance: textfield;
}

/* Special styling for wide sliders */
#nvert {
  width: 200px;
}

canvas, #canvas {
  border: 1px solid #ddd;
  border-radius: 4px;
  display: block;
  margin: 20px auto;
  background: white;
  aspect-ratio: 1 / 1;
  max-height: calc(100vh - 200px);
  max-width: calc(100vh - 200px);
  width: 100%;
  object-fit: contain;
}

p {
  margin: 15px 0;
}

hr {
  border: none;
  border-top: 2px solid #eee;
  margin: 30px 0;
}

/* Responsive design */
@media (max-width: 800px) {
  body {
    padding: 0px;
  }

  .container {
    padding: 5px;
    margin: 0px;
  }

  .slider, #nvert {
    width: 200px;
  }

  canvas, #canvas {
    max-height: calc(100vh - 300px);
    max-width: calc(100vh - 300px);
  }

}
