:root {
  --bg: #16110d;
  --cream: #f3e6c8;
  --cream-dim: rgba(243, 230, 200, 0.62);
  --brown-hi: #a7703f;
  --brown: #74462a;
  --brown-lo: #3e2416;
  --chrome-hi: #f4f4f2;
  --chrome-lo: #6d6d6a;
  --red: #e3261a;
  --lcd: #b9c98c;
  --lcd-ink: #26381a;
  --focus: #f2c14e;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background:
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(255, 190, 120, 0.16), transparent 70%),
    radial-gradient(ellipse 120% 80% at 50% 120%, #2a1a10, transparent 60%),
    var(--bg);
  color: var(--cream);
  font-family: "Futura", "Avenir Next", "Century Gothic", "Trebuchet MS", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

main {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px 24px;
  gap: 20px;
}

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ---------- the enclosure ---------- */

.rig {
  container-type: inline-size;
  position: relative;
  width: min(428px, calc(100vw - 32px));
  padding: 0 14px;
  filter: drop-shadow(0 30px 40px rgba(0, 0, 0, 0.6)) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
}

.pedal {
  position: relative;
  width: 100%;
  padding: 9cqi 8cqi 9cqi;
  border-radius: 7cqi;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5cqi;
  background:
    /* hammertone */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.09' numOctaves='3' seed='7'/%3E%3CfeDiffuseLighting lighting-color='%23fff' surfaceScale='2.2'%3E%3CfeDistantLight azimuth='225' elevation='55'/%3E%3C/feDiffuseLighting%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(160deg, var(--brown-hi) 0%, var(--brown) 45%, var(--brown-lo) 100%);
  background-blend-mode: soft-light, normal;
  box-shadow:
    inset 0 2px 1px rgba(255, 225, 190, 0.45),
    inset 0 -3px 2px rgba(0, 0, 0, 0.45),
    inset 3px 0 2px rgba(255, 225, 190, 0.12),
    inset -3px 0 2px rgba(0, 0, 0, 0.25);
}

.screw {
  position: absolute;
  width: 4.2cqi; height: 4.2cqi;
  border-radius: 50%;
  background:
    linear-gradient(45deg, transparent 44%, rgba(0, 0, 0, 0.55) 45% 55%, transparent 56%),
    radial-gradient(circle at 35% 30%, var(--chrome-hi), var(--chrome-lo) 75%);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.screw.tl { top: 3cqi; left: 3cqi; }
.screw.tr { top: 3cqi; right: 3cqi; transform: rotate(70deg); }
.screw.bl { bottom: 3cqi; left: 3cqi; transform: rotate(20deg); }
.screw.br { bottom: 3cqi; right: 3cqi; transform: rotate(110deg); }

.jack, .dc {
  position: absolute;
  z-index: -1;
  background: linear-gradient(180deg, #d9d9d6, #8a8a86 55%, #5b5b58);
  border-radius: 3px;
}
.jack { top: 17%; width: 22px; height: 30px; }
.jack-left { left: 0; }
.jack-right { right: 0; }
.dc { top: -12px; left: 50%; width: 30px; height: 20px; transform: translateX(-50%); }
.jack span, .dc span {
  position: absolute;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--cream-dim);
  white-space: nowrap;
}
.jack span { top: 38px; writing-mode: vertical-rl; }
.jack-left span { left: 4px; transform: rotate(180deg); }
.jack-right span { right: 4px; }
.dc span { bottom: 26px; left: 50%; transform: translateX(-50%); }

/* ---------- knobs ---------- */

.knobs {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  row-gap: 4.5cqi;
  column-gap: 2cqi;
  justify-items: center;
}

.knob-slot, .toggle-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2cqi;
  width: 100%;
}

.knob {
  --v: 0.5;
  position: relative;
  width: 23cqi;
  height: 23cqi;
  border-radius: 50%;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
}

.ticks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  stroke: var(--cream);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.85;
}

.knob-skirt {
  position: absolute;
  inset: 13%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, #2b2b2b 0deg 5deg, #121212 5deg 10deg);
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.6);
  transform: rotate(calc(-135deg + var(--v) * 270deg));
  transition: transform 60ms linear;
}

.knob-cap {
  position: absolute;
  inset: 11%;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #4a4a4a, #161616 70%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.18), inset 0 -2px 3px rgba(0, 0, 0, 0.7);
}

.knob-pointer {
  position: absolute;
  left: 50%;
  top: 6%;
  width: 7%;
  height: 36%;
  border-radius: 99px;
  transform: translateX(-50%);
  background: var(--cream);
}

.knob.grabbed .knob-skirt { transition: none; }
.knob:focus-visible { outline-offset: 0; }

.label {
  font-size: 3.6cqi;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cream);
}

.range {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 2.5cqi;
  font-style: italic;
  color: var(--cream-dim);
  margin-top: -0.6cqi;
  padding: 0 1cqi;
}

/* ---------- toggle switch ---------- */

.toggle-slot { justify-content: flex-end; }

.toggle {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  border-radius: 50%;
}

.toggle-plate {
  display: block;
  position: relative;
  width: 10cqi;
  height: 10cqi;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--chrome-hi), var(--chrome-lo) 80%);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.55);
}

.toggle-bat {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 3cqi;
  height: 9cqi;
  border-radius: 1.5cqi;
  background: linear-gradient(90deg, #8d8d8a, var(--chrome-hi) 40%, #9a9a97);
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.5);
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(-28deg);
  transition: transform 120ms cubic-bezier(0.3, 1.6, 0.6, 1);
}
.toggle.tight .toggle-bat { transform: translateX(-50%) rotate(28deg); }

.toggle-legend {
  display: flex;
  gap: 4cqi;
  font-size: 2.5cqi;
  letter-spacing: 0.1em;
  color: var(--cream-dim);
}

/* ---------- LCD ---------- */

.lcd {
  width: 100%;
  border-radius: 2.5cqi;
  padding: 2.5cqi 3cqi;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.035) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #c7d69b, var(--lcd) 60%, #a5b678);
  color: var(--lcd-ink);
  box-shadow:
    0 0 0 1.4cqi #1b1410,
    0 0 0 1.8cqi rgba(255, 220, 180, 0.25),
    inset 0 2px 6px rgba(0, 0, 0, 0.35);
  margin: 1.5cqi 0 0;
  display: flex;
  flex-direction: column;
  gap: 1.5cqi;
}

#scope {
  display: block;
  width: 100%;
  height: 12cqi;
}

.lcd-text { min-height: 9cqi; }

.lcd-name {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 4.2cqi;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.lcd-meta {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 2.8cqi;
  opacity: 0.75;
}

/* ---------- branding ---------- */

.brand { text-align: center; line-height: 1; margin-top: 2cqi; }

.brand-maker {
  font-size: 3.2cqi;
  letter-spacing: 0.5em;
  margin-right: -0.5em;
  font-weight: 700;
  color: var(--cream-dim);
}

.brand-model {
  margin-top: 1.5cqi;
  font-family: "Cooper Black", "Cooper Std", "Bookman Old Style", Georgia, serif;
  font-weight: 900;
  font-style: italic;
  font-size: 10cqi;
  white-space: nowrap;
  letter-spacing: -0.01em;
  color: var(--cream);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), 0 -1px 0 rgba(255, 230, 200, 0.2);
}

.brand-sub {
  margin-top: 1.6cqi;
  font-size: 2.6cqi;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

/* ---------- LED ---------- */

.led {
  width: 3.6cqi;
  height: 3.6cqi;
  border-radius: 50%;
  margin-top: 1cqi;
  background: radial-gradient(circle at 40% 35%, #7a2a24, #3a0d0a 70%);
  box-shadow: 0 0 0 1cqi #23170f, 0 0 0 1.3cqi rgba(255, 220, 180, 0.2);
  transition: background 60ms, box-shadow 60ms;
}
.led.on {
  background: radial-gradient(circle at 40% 35%, #fff2ec, #ff3b24 45%, #b00d00);
  box-shadow: 0 0 0 1cqi #23170f, 0 0 0 1.3cqi rgba(255, 220, 180, 0.2), 0 0 4cqi 1.5cqi rgba(255, 50, 20, 0.75);
}

/* ---------- the big red button ---------- */

.stomp-wrap { display: flex; flex-direction: column; align-items: center; gap: 2.4cqi; }

.stomp {
  appearance: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  width: 30cqi;
  height: 30cqi;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, var(--chrome-hi), #9b9b98 50%, #4c4c4a 100%);
  box-shadow:
    0 6px 8px rgba(0, 0, 0, 0.55),
    0 0 0 0.8cqi rgba(0, 0, 0, 0.35),
    inset 0 -2px 3px rgba(0, 0, 0, 0.4);
  display: grid;
  place-items: center;
  touch-action: manipulation;
}

.stomp-cap {
  width: 78%;
  height: 78%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 45% 30% at 40% 26%, rgba(255, 255, 255, 0.75), transparent 70%),
    radial-gradient(circle at 50% 40%, #ff5a3c, var(--red) 45%, #8f0f06 100%);
  box-shadow:
    0 0.9cqi 0 #7b0b04,
    0 1.6cqi 1.6cqi rgba(0, 0, 0, 0.5),
    inset 0 -1.2cqi 2cqi rgba(80, 0, 0, 0.55);
  transform: translateY(-0.6cqi);
  transition: transform 50ms ease-out, box-shadow 50ms ease-out, filter 120ms;
}

.stomp:hover .stomp-cap { filter: brightness(1.06); }
.stomp.down .stomp-cap,
.stomp:active .stomp-cap {
  transform: translateY(0.3cqi);
  box-shadow: 0 0 0 #7b0b04, 0 0.4cqi 0.6cqi rgba(0, 0, 0, 0.5), inset 0 -0.6cqi 1.4cqi rgba(80, 0, 0, 0.6);
}

.stomp-label {
  font-size: 3cqi;
  font-weight: 700;
  letter-spacing: 0.32em;
  margin-right: -0.32em;
  color: var(--cream);
}

/* ---------- below the pedal ---------- */

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.controls button {
  appearance: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--cream);
  background: rgba(243, 230, 200, 0.06);
  border: 1px solid rgba(243, 230, 200, 0.22);
  border-radius: 999px;
  padding: 8px 16px;
  min-height: 36px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, opacity 120ms;
}
.controls button:hover:not(:disabled) { background: rgba(243, 230, 200, 0.12); border-color: rgba(243, 230, 200, 0.4); }
.controls button:active:not(:disabled) { transform: translateY(1px); }
.controls button:disabled { opacity: 0.35; cursor: default; }

.fine {
  margin: 0;
  max-width: 400px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
  color: var(--cream-dim);
}
.fine.ios { display: none; }
@supports (-webkit-touch-callout: none) { .fine.ios { display: block; } }

@media (prefers-reduced-motion: reduce) {
  .knob-skirt, .toggle-bat, .stomp-cap { transition: none; }
}
