:root {
  --bg: #090b0f;
  --card: #0c0f14;
  --edge: #171b23;
  --dim: #283040;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: #6c7482;
  font: 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 12px;
}

main {
  width: min(100%, calc((100vh - 130px) * 2));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.card {
  position: relative;
  padding: 8px 6px 2px;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 6px;
  cursor: pointer;
}

.card .tag {
  position: absolute;
  top: -1px;
  left: 8px;
  width: 24%;
  height: 2px;
  background: var(--c);
}

.card .name {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 3px;
  background: none;
  border: 0;
  color: #4a515d;
  font: inherit;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.card .name:disabled {
  cursor: inherit;
}

.card .name .on,
.card .name:not(:has(span)) {
  color: var(--c);
  opacity: 0.8;
}

.card svg {
  display: block;
  width: 100%;
  height: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  stroke-linejoin: round;
}

.card .base {
  color: var(--dim);
}

.card .lit {
  color: var(--c);
  opacity: 0;
}

.card .j {
  fill: currentColor;
  stroke: none;
}

.card .spark {
  fill: #fff;
  stroke: none;
  opacity: 0;
  filter: drop-shadow(0 0 2px #fff);
}

.card canvas {
  display: block;
  width: 100%;
  aspect-ratio: 186 / 108;
  background: #0a0c10;
  border: 1px solid #1b2029;
}

.dots {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 18px;
  padding: 0 5px;
}

.dots b {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #262c36;
}

.dots b.cur {
  background: #4d5461;
}

.dots b.on {
  width: 6px;
  height: 6px;
  background: var(--c);
  opacity: 0.7;
}

.dots b.on.cur {
  opacity: 1;
  box-shadow: 0 0 6px var(--c);
}

.mixer .dots b {
  width: 6px;
  height: 6px;
  background: #3a404b;
  opacity: 1;
  box-shadow: none;
}

.mixer .dots b.cur {
  background: var(--c);
}

.bar {
  display: flex;
  align-items: center;
  gap: 3%;
  padding: 18px 16px 12px;
  background: #1c1e23;
  border: 1px solid #2a2d33;
  border-radius: 6px;
}

.bar button {
  cursor: pointer;
}

.start {
  flex: none;
  width: 60px;
  height: 32px;
  background: #a3261f;
  border: 1px solid #5f1812;
  border-radius: 2px;
}

.start.on {
  background: #d4382d;
  box-shadow: 0 0 14px rgba(212, 56, 45, 0.45);
}

.tempo {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.knob {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e6dfcb;
  cursor: ns-resize;
  touch-action: none;
}

.knob::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 4px;
  width: 2px;
  height: 11px;
  background: #2a2a2a;
}

.bpm {
  width: 3ch;
  color: #8a909a;
}

.keys {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 8px;
}

.key {
  position: relative;
  height: 32px;
  padding: 0;
  background: var(--k);
  border: 1px solid transparent;
  border-radius: 2px;
}

.key.cur {
  filter: brightness(0.72);
  border-color: #9a9ea5;
}

.key .led {
  position: absolute;
  top: -11px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: #3d1512;
}

.key.on .led {
  background: #9b2b22;
}

.key.cur .led {
  background: #ff3b2f;
  box-shadow: 0 0 6px #ff3b2f;
}

button:focus-visible,
.knob:focus-visible {
  outline: 1px solid #9a9ea5;
  outline-offset: 2px;
}

@media (max-width: 900px) {
  main {
    width: 100%;
  }
  #grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .bar {
    flex-wrap: wrap;
    row-gap: 20px;
  }
  .keys {
    flex-basis: 100%;
    grid-template-columns: repeat(8, 1fr);
    row-gap: 18px;
  }
}

@media (max-width: 560px) {
  body {
    padding: 8px;
  }
  #grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
}
