:root {
  --bg: #f4efe6;
  --fg: #2b2622;
  --muted: #7a7068;
  --panel: #fffaf2;
  --border: #ddd3c4;
  --accent: #e0702a;
  --rail: #8a6a4a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1917;
    --fg: #f0e9e0;
    --muted: #a39a90;
    --panel: #26231f;
    --border: #3a352f;
    --accent: #f08a45;
    --rail: #5e4836;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  text-align: center;
}

h1 { font-weight: 650; letter-spacing: -0.01em; margin: 0 0 4px; }

.hint { color: var(--accent); min-height: 1.4em; margin: 0 0 20px; transition: opacity .3s; }
.hint.hidden { opacity: 0; }

.instrument { display: flex; flex-direction: column; gap: 28px; }

.row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  padding: 0 8px;
}
/* Rails the bars rest on */
.row::before, .row::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 6px;
  border-radius: 3px;
  background: var(--rail);
  z-index: 0;
}
.row::before { top: 30%; }
.row::after { bottom: 30%; }

.bar {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  max-width: 76px;
  border: none;
  border-radius: 8px;
  color: rgba(0,0,0,.65);
  font: 600 15px/1 system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  cursor: pointer;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,.18), 0 3px 6px rgba(0,0,0,.2);
  transition: transform .08s, filter .08s, box-shadow .08s;
  user-select: none;
  touch-action: manipulation;
}
.bar .note { font-size: 11px; font-weight: 500; opacity: .7; }
.bar::before, .bar::after { /* screws */
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(0,0,0,.3);
}
.bar::before { order: -1; }
.bar.hit {
  transform: translateY(3px) scaleY(.98);
  filter: brightness(1.25);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18), 0 0 18px rgba(255,255,255,.35);
}

.controls {
  margin-top: 36px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.picker { display: flex; align-items: center; gap: 8px; }
.picker select {
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
}

.toggle, .tempo, .picker {
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  font: inherit;
}
.toggle { cursor: pointer; }
.toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.toggle[aria-pressed="true"] kbd { color: #fff; border-color: rgba(255,255,255,.5); }

.tempo { display: flex; align-items: center; gap: 10px; }
.tempo input { accent-color: var(--accent); width: 160px; }
.tempo output { font-variant-numeric: tabular-nums; min-width: 3ch; font-weight: 600; }

kbd {
  font: 12px ui-monospace, monospace;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--muted);
}

.steps {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 20px;
}
.steps span {
  width: 12px; height: 12px;
  border-radius: 3px;
  background: var(--border);
}
.steps span:nth-child(4n+1) { background: color-mix(in srgb, var(--border) 60%, var(--muted)); }
.steps span.on { background: var(--accent); }

.help { color: var(--muted); margin-top: 24px; font-size: 14px; line-height: 2; }

@media (max-width: 600px) {
  .row { gap: 3px; padding: 0; }
  .bar { font-size: 12px; border-radius: 5px; }
  .bar .note { display: none; }
  .tempo input { width: 110px; }
}
