@import url('https://fonts.googleapis.com/css2?family=Bungee&family=Space+Mono:wght@400;700&display=swap');

:root {
  --gold: #fed43f;
  --sea: #2bb8b3;
  --pink: #e151af;
  --baby: #bed7d8;
  --ink: #1f2430;
  --paper: #f6efdc;
  --board: #ddd3bb;
  --line: 2px;
  --thick: 3px;
  --noise: 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.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

body {
  position: relative;
  margin: 0;
  background-color: var(--board);
  background-image:
    radial-gradient(circle at 30% 10%, rgba(255, 255, 255, 0.5), transparent 55%),
    radial-gradient(rgba(31, 36, 48, 0.14) 1px, transparent 1.2px);
  background-size: auto, 9px 9px;
  color: var(--ink);
  font-family: "Space Mono", ui-monospace, Menlo, monospace;
  font-size: 11px;
  padding: 20px;
  min-height: 100vh;
  user-select: none;
}

.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: var(--noise);
  opacity: 0.16;
  mix-blend-mode: multiply;
  z-index: 50;
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 2px 16px;
  padding: 8px 16px;
  background: var(--paper);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(0, 0, 0, 0.04));
  border: var(--thick) solid var(--ink);
  border-radius: 10px;
  box-shadow: 4px 4px 0 var(--ink), 8px 12px 18px rgba(31, 36, 48, 0.3);
}

h1 {
  font-family: Bungee, "Space Mono", monospace;
  font-size: 26px;
  font-weight: 400;
  margin: 0;
  color: var(--pink);
  letter-spacing: 0.04em;
  text-shadow: 3px 3px 0 var(--ink);
  -webkit-text-stroke: 1px var(--ink);
}

h1 span { color: var(--sea); }

.tagline { margin: 0; color: var(--ink); opacity: 0.7; flex: 1; }

#headerKnobs .knob { width: 70px; }
#headerKnobs .knob svg { width: 52px; height: 52px; }
#headerKnobs .knob .val { display: none; }

#scope {
  width: 100%;
  height: 150px;
  display: block;
  border: var(--thick) solid var(--ink);
  border-radius: 10px;
  margin-bottom: 0;
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink), 8px 12px 18px rgba(31, 36, 48, 0.3), inset 0 0 0 4px var(--paper), inset 0 0 0 5.5px var(--ink), inset 0 0 30px rgba(31, 36, 48, 0.12);
}

#board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(276px, 1fr));
  gap: 30px;
  margin-top: 84px;
  align-items: start;
}

#cables {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 3;
  filter: drop-shadow(3px 5px 3px rgba(31, 36, 48, 0.35));
}

.jack {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: radial-gradient(circle at 50% 50%, #0d0f14 0 28%, #5a5e6a 30% 48%, #d8d8dd 50% 66%, #6a6e7a 68%);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  z-index: 4;
}

.jack span {
  position: absolute;
  font-size: 7.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
  color: var(--ink);
  opacity: 0.85;
  mix-blend-mode: multiply;
}

.jack.left { left: -11px; }
.jack.left span { left: 26px; top: 4px; }
.jack.right { right: -11px; }
.jack.right span { right: 26px; top: 4px; }
.jack.top { top: -11px; transform: translateX(-50%); }
.jack.top span { top: 24px; left: 50%; transform: translateX(-50%); }
.jack.top.out span::after { content: ' ▸'; }
.jack.top.in span::before { content: '▸ '; }
.jack.top { opacity: 0.55; }
.jack.top.connected, .jack.extra.connected { opacity: 1; box-shadow: 0 0 0 3px var(--accent), 0 2px 3px rgba(0, 0, 0, 0.45); }
.jack.extra { opacity: 0.55; }

.jack.main {
  position: relative;
  margin: 0 4px 0 18px;
}
#mainJack { display: flex; align-items: center; height: 44px; }
.jack.main span { top: 24px; left: 50%; transform: translateX(-50%); }

#headerKnobs { display: flex; align-items: flex-start; gap: 4px; }

.pedal {
  position: relative;
  z-index: 1;
  border: var(--thick) solid var(--ink);
  border-radius: 14px;
  padding: 40px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 30%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.14) 100%),
    linear-gradient(100deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.08));
  box-shadow:
    4px 4px 0 var(--ink),
    10px 16px 22px rgba(31, 36, 48, 0.38),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    inset 0 0 48px rgba(31, 36, 48, 0.16);
  color: var(--ink);
  --accent: var(--ink);
}

.pedal:nth-child(2) { transform: rotate(-0.5deg); }
.pedal:nth-child(3) { transform: rotate(0.35deg); }
.pedal:nth-child(4) { transform: rotate(-0.25deg); }
.pedal:nth-child(5) { transform: rotate(0.45deg); }

.pedal .grain {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  background-image: var(--noise);
  opacity: 0.28;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.pedal::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  opacity: 0.45;
  pointer-events: none;
}

.screw {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: radial-gradient(circle at 35% 30%, #ffffff, #b9b9bf 55%, #6f6f78);
  box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.screw::after {
  content: '';
  position: absolute;
  left: 1px;
  right: 1px;
  top: 50%;
  height: 1.5px;
  margin-top: -0.75px;
  background: var(--ink);
  transform: rotate(var(--rot));
}

.screw.tl { top: 6px; left: 6px; }
.screw.tr { top: 6px; right: 6px; }
.screw.bl { bottom: 6px; left: 6px; }
.screw.br { bottom: 6px; right: 6px; }

.pedal.gold { background-color: var(--gold); --accent: var(--pink); }
.pedal.baby { background-color: var(--baby); --accent: var(--pink); }
.pedal.sea { background-color: var(--sea); --accent: var(--gold); }
.pedal.pink { background-color: var(--pink); --accent: var(--gold); }

.knobs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 4px;
  justify-items: center;
  padding: 12px 6px 8px;
  border: var(--line) solid var(--ink);
  border-radius: 8px;
  background: rgba(246, 239, 220, 0.22);
  box-shadow: inset 0 2px 6px rgba(31, 36, 48, 0.25), inset 0 -1px 0 rgba(255, 255, 255, 0.35);
}

.knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 82px;
  gap: 2px;
}

.knob svg {
  width: 68px;
  height: 68px;
  cursor: ns-resize;
  touch-action: none;
}

.knob .skirt { fill: rgba(31, 36, 48, 0.12); stroke: var(--ink); stroke-width: 2; }
.knob .shadow { fill: rgba(31, 36, 48, 0.4); }
.knob .cap { stroke: var(--ink); stroke-width: 2.2; }
.knob .inner { fill: none; stroke: var(--ink); stroke-width: 1; opacity: 0.35; }
.knob .gloss { pointer-events: none; }
.knob .tip { stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; }
.knob .tick { stroke: var(--ink); stroke-width: 1.5; }
.knob .tick.big { stroke-width: 2.5; }
.knob.dragging .cap { stroke: var(--accent); stroke-width: 3; }

.knob label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 8.5px;
  opacity: 0.85;
  mix-blend-mode: multiply;
}

.knob .val { font-size: 8.5px; opacity: 0.65; mix-blend-mode: multiply; }

.switches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  justify-content: center;
}

.switch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.switch.hidden { display: none; }

.switch label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.85;
  mix-blend-mode: multiply;
}

select {
  background: linear-gradient(180deg, #fffdf5, #e8dfc6);
  color: var(--ink);
  border: var(--line) solid var(--ink);
  border-radius: 4px;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  cursor: pointer;
  box-shadow: 1px 2px 0 var(--ink), 0 3px 4px rgba(0, 0, 0, 0.25);
  max-width: 130px;
}

button.toggle {
  width: 44px;
  height: 22px;
  border-radius: 11px;
  border: var(--line) solid var(--ink);
  background: linear-gradient(180deg, #cfc4a6, #f1e9d2);
  position: relative;
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35);
}

button.toggle::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff, #b9b9bf 55%, #6f6f78);
  border: 1px solid var(--ink);
  box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.45);
  transition: left 0.12s;
}

button.toggle.active { background: var(--accent); }
button.toggle.active::after { left: 23px; }

.badge {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 2px 0;
}

.led {
  --lit: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: color-mix(in srgb, var(--accent) calc(var(--lit) * 100%), #3a3630);
  box-shadow: 0 0 calc(var(--lit) * 14px) calc(var(--lit) * 4px) var(--accent), inset 0 1px 2px rgba(255, 255, 255, 0.6);
}

.badge h2 {
  margin: 0;
  font-family: Bungee, "Space Mono", monospace;
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 0.12em;
  padding: 5px 16px 3px;
  border: var(--thick) solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(0, 0, 0, 0.05));
  color: var(--pink);
  box-shadow: 3px 3px 0 var(--ink), 4px 6px 8px rgba(0, 0, 0, 0.3), inset 0 0 0 2px var(--paper), inset 0 0 0 3.5px var(--ink);
}

.pedal.sea .badge h2, .pedal.pink .badge h2 { color: var(--ink); background-color: var(--gold); }

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.footwrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.footwrap label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.85;
  mix-blend-mode: multiply;
}

button.foot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: radial-gradient(circle at 40% 35%, #ffffff, #c9c9cf 45%, #7a7a84 80%, #4a4a52);
  box-shadow: 0 4px 0 var(--ink), 0 6px 8px rgba(0, 0, 0, 0.4), inset 0 0 0 6px rgba(0, 0, 0, 0.12), inset 0 0 0 7px rgba(255, 255, 255, 0.35);
  cursor: pointer;
  font-size: 0;
  padding: 0;
}

button.foot.lit { box-shadow: 0 4px 0 var(--ink), 0 6px 8px rgba(0, 0, 0, 0.4), 0 0 0 3px var(--accent), inset 0 0 0 6px rgba(0, 0, 0, 0.12), inset 0 0 0 7px rgba(255, 255, 255, 0.35); }

button.foot:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink), 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 0 0 6px rgba(0, 0, 0, 0.2); }

button.foot.start {
  width: auto;
  height: auto;
  border-radius: 8px;
  padding: 10px 24px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(180deg, #ffe07a, var(--gold) 50%, #e2b61f);
  border-width: var(--thick);
  box-shadow: 3px 3px 0 var(--ink), 4px 6px 8px rgba(0, 0, 0, 0.3);
}

button.foot.start:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
button.foot.start.random { background: linear-gradient(180deg, #ffffff, var(--paper) 50%, #d9cfb3); margin-right: 4px; }

@keyframes shake {
  0% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(-2px, 1px) rotate(-0.6deg); }
  50% { transform: translate(2px, -1px) rotate(0.6deg); }
  75% { transform: translate(-1px, 2px) rotate(-0.3deg); }
  100% { transform: translate(0, 0) rotate(0); }
}

.pedal.shake { animation: shake 0.45s ease-in-out; }

.octave {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.octave span {
  min-width: 70px;
  text-align: center;
  padding: 3px 8px;
  background: var(--ink);
  color: var(--gold);
  border-radius: 4px;
  font-family: "Space Mono", monospace;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.3);
}

.octave small { opacity: 0.6; font-weight: 400; text-transform: none; letter-spacing: 0; }

button.octbtn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: linear-gradient(180deg, #fffdf5, #e8dfc6);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink);
  padding: 0;
  line-height: 1;
}

button.octbtn:active { transform: translateY(2px); box-shadow: none; }

.pads {
  display: flex;
  gap: 4px;
  width: 100%;
  justify-content: center;
}

button.pad {
  width: 24px;
  padding: 5px 0 3px;
  background: linear-gradient(180deg, #fffdf5, #e8dfc6);
  color: var(--ink);
  border: var(--line) solid var(--ink);
  border-radius: 4px;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink), 0 3px 4px rgba(0, 0, 0, 0.3);
}

button.pad.black { background: linear-gradient(180deg, #3a3f4c, var(--ink)); color: var(--paper); }
button.pad small { font-size: 8px; font-weight: 400; opacity: 0.6; }
button.pad.lit, button.pad:active { background: var(--pink); color: var(--paper); transform: translateY(2px); box-shadow: 0 0 0 var(--ink); }

.drop {
  width: 100%;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1.5px dashed var(--ink);
  border-radius: 6px;
  background: rgba(246, 239, 220, 0.4);
  font-size: 9px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.drop.over { border-style: solid; border-color: var(--pink); }
.drop input { font: inherit; font-size: 9px; max-width: 150px; }
.sampleInfo { font-weight: 700; }

@media (max-width: 900px) {
  body { padding: 12px; font-size: 10px; }
  header { flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; }
  h1 { font-size: 22px; }
  .tagline { flex: 1 1 100%; order: 5; opacity: 0.6; }
  .tagline .keys { display: none; }
  #headerKnobs { margin-left: auto; }
  #headerKnobs .knob { width: 54px; }
  #headerKnobs .knob svg { width: 44px; height: 44px; }
  #mainJack { display: none; }
  button.foot.start { padding: 8px 14px; font-size: 11px; }
  button.foot.start.random { padding: 8px 10px; }
  button.foot.start.random span { display: none; }
  .knob label { white-space: nowrap; font-size: 8px; letter-spacing: 0.08em; }
  #scope { height: 110px; margin-bottom: 0; }
  #board { grid-template-columns: 1fr; gap: 22px; margin-top: 22px; }
  #cables, .jack { display: none; }
  .pedal { padding: 22px 12px 14px; transform: none !important; }
  .pedal .knobs { gap: 8px 2px; padding: 10px 2px 6px; }
  .knob { width: 30%; }
  .knob svg { width: 60px; height: 60px; }
  .pads { flex-wrap: wrap; gap: 2px; }
  button.pad { width: 21px; padding: 4px 0 3px; font-size: 8.5px; }
  .drop { font-size: 8.5px; }
  .drop input { max-width: 100%; }
  .paper-grain { opacity: 0.1; }
}

@media (max-width: 420px) {
  .knob svg { width: 54px; height: 54px; }
  .badge h2 { font-size: 18px; }
}
