html, body {
  height: 100%;
  display: flex;
  margin: 0;
  flex-direction: column;
  font-family: Arial, sans-serif;
}

header {
  background: linear-gradient(to left, red, orange, yellow, green, blue, indigo, violet);
  text-align: center;
  padding: 10px;
}

main {
  flex: 1;
  background-color: rgba(0, 0, 0, 0.88);
  text-align: center;
  padding: 20px;
  color: white;
}

footer {
  background-color: rgb(200, 142, 9);
  text-align: center;
  padding: 10px;
}

label {
  display: inline-block;
  width: 60px;
}

#preview {
  width: 90%;              /* flexible for small screens */
  max-width: 300px;        /* still neat on desktop */
  height: 150px;
  background: rgb(100, 100, 100);
  margin: 20px auto;
  border: 3px solid white;
  border-radius: 8px;
}

.color-box {
  display: inline-block;
  width: 15px;
  height: 15px;
}

.red { background: red; }
.green { background: green; }
.blue { background: blue; }

.color-mixer {
  display: block;          /* was inline-block */
  background: black;
  padding: 20px 40px;
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  max-width: 400px;        /* prevents over-stretching */
}

#red-val,
#green-val,
#blue-val {
  display: inline-block;
  width: 40px;
}

input[type="range"] {
  width: 60%;              /* flexible slider size */
  max-width: 250px;
  margin: 8px 0;
}

/* 📱 Mobile adjustments */
@media (max-width: 500px) {
  label {
    display: block;        /* stack labels on small screens */
    margin: 5px 0;
    text-align: center;
  }

  input[type="range"] {
    width: 80%;            /* bigger slider for touch */
  }

  .color-mixer {
    padding: 15px 20px;
  }
}
