*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --space: #050505;
  --ink: rgba(240, 232, 214, 0.86);
  --ink-dim: rgba(240, 232, 214, 0.45);
  --amber: #e69b29;
  --panel: rgba(18, 14, 16, 0.62);
  --panel-edge: rgba(232, 232, 137, 0.22);
  --radius: 999px;
  --transition: 220ms ease;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--space);
  color: var(--ink);
  font-family: var(--font);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

#overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  /* the arcs pass behind the text, so every label needs its own shadow */
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.95);
}

#overlay * {
  pointer-events: auto;
}

#caption {
  position: absolute;
  top: clamp(14px, 3vh, 34px);
  left: clamp(14px, 3vw, 40px);
  max-width: min(30rem, 70vw);
}

#caption h1 {
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(236, 201, 77, 0.9);
}

#caption p {
  margin-top: 0.45rem;
  font-size: clamp(0.78rem, 1.15vw, 0.92rem);
  line-height: 1.5;
  color: var(--ink-dim);
}

#hud {
  position: absolute;
  top: clamp(14px, 3vh, 34px);
  right: clamp(14px, 3vw, 40px);
  display: flex;
  gap: 1.1rem;
  font-size: clamp(0.7rem, 1vw, 0.82rem);
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

#hud b {
  color: var(--ink);
  font-weight: 600;
}

#controls {
  position: absolute;
  bottom: clamp(16px, 4vh, 40px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.45rem 1.15rem;
  max-width: min(46rem, 94vw);
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--panel-edge);
  border-radius: 1.4rem;
  background: var(--panel);
  backdrop-filter: blur(6px);
  opacity: 0.45;
  transition: opacity var(--transition);
}

#controls:hover,
#controls:focus-within,
body.is-paused #controls {
  opacity: 1;
}

#controls button {
  min-width: 5.2rem;
  padding: 0.42rem 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: rgba(230, 155, 41, 0.14);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

#controls button:hover,
#controls button:focus-visible {
  background: rgba(230, 155, 41, 0.28);
  border-color: rgba(236, 201, 77, 0.5);
  outline: none;
}

/* a named slider with its live value: speed, count to */
.dial {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  color: var(--ink-dim);
  cursor: pointer;
}

.dial-name {
  white-space: nowrap;
}

.dial output {
  min-width: 2.1rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.dial input[type="range"] {
  width: clamp(4.5rem, 11vw, 7rem);
  height: 1.1rem;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.dial input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: var(--radius);
  background: rgba(240, 232, 214, 0.28);
}

.dial input[type="range"]::-moz-range-track {
  height: 2px;
  border-radius: var(--radius);
  background: rgba(240, 232, 214, 0.28);
}

.dial input[type="range"]::-webkit-slider-thumb {
  width: 0.72rem;
  height: 0.72rem;
  margin-top: -0.29rem;
  border: none;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(230, 155, 41, 0.7);
  -webkit-appearance: none;
  appearance: none;
}

.dial input[type="range"]::-moz-range-thumb {
  width: 0.72rem;
  height: 0.72rem;
  border: none;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(230, 155, 41, 0.7);
}

.dial input[type="range"]:focus-visible {
  outline: 1px solid rgba(236, 201, 77, 0.6);
  outline-offset: 4px;
}

#hint {
  padding-right: 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--ink-dim);
}

@media (max-width: 600px) {
  #caption p,
  #hint {
    display: none;
  }

  /* the caption and the counters cannot share the top row on a phone, and the control bar
     grows to three rows down there, so the counters tuck under the caption instead */
  #hud {
    top: calc(clamp(14px, 3vh, 34px) + 1.9rem);
    right: auto;
    left: clamp(14px, 3vw, 40px);
    gap: 0.8rem;
  }
}
