/* =========================
   Reset & viewport control
   ========================= */
:root {
  --ui-scale: clamp(1.2, 1.5vw, 1.6);
}
p {
  font-size: calc(13px * var(--ui-scale));
  line-height: calc(14px * var(--ui-scale));
}
span {
  font-size: calc(12px * var(--ui-scale));
  min-width: calc(50px * var(--ui-scale));
}
p,
span {
  margin-bottom: calc(6px * var(--ui-scale));
}
input[type="range"] {
  width: calc(200px * var(--ui-scale));
  height: calc(6px * var(--ui-scale));
}
input[type="range"]::-webkit-slider-thumb {
  width: calc(16px * var(--ui-scale));
  height: calc(16px * var(--ui-scale));
}

input[type="range"]::-moz-range-thumb {
  width: calc(16px * var(--ui-scale));
  height: calc(16px * var(--ui-scale));
}
button {
  font-size: calc(13px * var(--ui-scale));
  padding: calc(6px * var(--ui-scale)) calc(12px * var(--ui-scale));
  border-radius: calc(10px * var(--ui-scale));
}
.ui-panel {
  padding: calc(14px * var(--ui-scale));
}


html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;            /* critical */
  background: #0b0e14;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  color: #e6e6eb;
  touch-action: none;
}

/* =========================
   p5 canvas
   ========================= */

canvas {
  position: fixed;             /* stick to viewport */
  top: 0;
  left: 0;
  width: 100vw;                /* match viewport */
  height: 1calc(var(--vh) * 100);
  display: block;
  border-radius: 18px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.7);
}

/* =========================
   Labels (createP)
   ========================= */

p {
  text-align: right;
  margin: 0;
  padding: 0;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: #cdd6f4;
  user-select: none;
}

/* =========================
   Sliders
   ========================= */

input[type="range"] {
  position: relative;
  top: 2px;
  -webkit-appearance: none;
  width: 200px;
  height: 6px;
  margin-left: 40px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #3b82f6,
    #22d3ee
  );
  outline: none;
  opacity: 0.95;
}

input[type="range"]:hover {
  opacity: 1;
}

/* slider thumb */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e6e6eb;
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.8);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e6e6eb;
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.8);
  cursor: pointer;
}

/* =========================
   Buttons
   ========================= */

button {
  background: linear-gradient(
    135deg,
    #2563eb,
    #06b6d4
  );
  /* margin-right: 8px; */
  border: none;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  color: #f8fafc;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.6);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(6, 182, 212, 0.4);
}

/* Stop button (2nd button) */
button:nth-of-type(2) {
  background: linear-gradient(
    135deg,
    #ef4444,
    #f97316
  );
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.45);
}

/* Reset button (3rd button) */
button:nth-of-type(3) {
  background: linear-gradient(
    135deg,
    #64748b,
    #94a3b8
  );
  box-shadow: 0 4px 14px rgba(148, 163, 184, 0.35);
}

/* =========================
   UI panel (optional but nice)
   ========================= */

.ui-panel {
  position: fixed;
  top: 14px;
  left: 14px;
  padding-left: env(safe-area-inset-left);
  padding-top: env(safe-area-inset-top);
  border-radius: 14px;
  background: rgba(20, 25, 40, 0.7);
  backdrop-filter: blur(12px);
  box-shadow: 0 0 30px rgba(0, 150, 255, 0.2);
  z-index: 10;
}


@media (max-width: 768px) {

  p {
    font-size: 11px;
  }

  input[type="range"] {
    width: 150px;
  }

  button {
    font-size: 11px;
    padding: 5px 12px;
  }

  .ui-panel {
    top: 8px;
    left: 8px;
    padding: 12px;
    transform: scale(0.9);
    transform-origin: top left;
  }
}
span {
  display: inline-block;
  min-width: 50px;
  margin-left: 25px;
  font-size: 12px;
  color: #94e2ff;
  text-align: left;
  user-select: none;
  font-variant-numeric: tabular-nums;
}

p,
span {
  line-height: 8px;
}

input[type="range"] {
  height: 6px;
}
