:root {
  --bg: #08080c;
  --panel: #13131b;
  --edge: #2c2c3a;
  --text: #ddd8e8;
  --dim: #9c96ad;
  --accent: #e0a458;
  --accent-ink: #1a1206;
  --fill: #5a4a7a;
  --fill-hi: #8a74b8;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-text-size-adjust: 100%;
}

#app {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  max-width: 520px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px calc(env(safe-area-inset-bottom, 0px) + 28px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spine .chip {
  margin: 0;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}
.spine h1 { margin: 2px 0 8px; font-size: 26px; font-weight: 650; letter-spacing: .01em; }
.spine hr { margin: 0; border: 0; border-top: 1px solid var(--edge); }

button { font: inherit; color: inherit; }

.btn, .play, .chip-btn {
  touch-action: none;
  border: 2px solid var(--edge);
  background: var(--panel);
  border-radius: var(--radius);
  min-height: 56px;
  cursor: pointer;
}
.btn:active, .chip-btn:active { border-color: var(--fill-hi); }
.btn:focus-visible, .play:focus-visible, .chip-btn:focus-visible, .fader:focus-visible {
  outline: 3px solid var(--fill-hi);
  outline-offset: 2px;
}

.play {
  min-height: 84px;
  font-size: 26px;
  font-weight: 650;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-color: var(--accent);
  color: var(--accent);
}
.play .glyph {
  width: 0; height: 0;
  border-style: solid;
  border-width: 13px 0 13px 22px;
  border-color: transparent transparent transparent currentColor;
}
.play[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.play[aria-pressed="true"] .glyph { width: 22px; height: 22px; border: 0; background: currentColor; border-radius: 3px; }

.wake {
  margin: 0;
  padding: 12px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  text-align: center;
}

.group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.group h2 {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
}

.stepper, .tempo {
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  gap: 10px;
}
.step { font-size: 30px; line-height: 1; }
.readout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  border-radius: var(--radius);
  background: var(--panel);
  font-size: 24px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.readout.big { font-size: 30px; }
.readout small { font-size: 13px; color: var(--dim); font-weight: 600; letter-spacing: .08em; }

.beat {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .15;
}

.tempo2 {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 10px;
}
.tap { font-size: 20px; font-weight: 650; letter-spacing: .06em; }
.tap.hit { border-color: var(--accent); }

.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chips.two { grid-template-columns: repeat(2, 1fr); }
.chips.three { grid-template-columns: repeat(3, 1fr); }
.chip-btn { font-size: 16px; font-weight: 600; color: var(--dim); min-height: 52px; }
.chip-btn[aria-checked="true"] {
  background: var(--fill);
  border-color: var(--fill-hi);
  color: #fff;
  font-weight: 750;
}

.fader {
  position: relative;
  height: 58px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 2px solid var(--edge);
  overflow: hidden;
  touch-action: none;
  cursor: ew-resize;
}
.fader .fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--fill);
  border-right: 3px solid var(--fill-hi);
}
.fader.master .fill { background: #6e5530; border-right-color: var(--accent); }
.fader .name, .fader .val {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  font-weight: 650;
  pointer-events: none;
}
.fader .name { left: 16px; }
.fader .val { right: 16px; font-variant-numeric: tabular-nums; color: var(--dim); }
.fader.drag { border-color: var(--fill-hi); }
.fader.drag .val { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
