.bpm-console {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 24px;
  position: relative;
}
.bpm-console-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.bpm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.bpm-tab {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 16px;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.bpm-tab:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.bpm-tab.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}
.bpm-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.bpm-chip {
  appearance: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 16px;
  transition: background 140ms ease, border-color 140ms ease;
}
.bpm-chip:hover {
  border-color: var(--ink);
  background: #ede4d6;
}
.bpm-chip-danger:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.bpm-deck {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.bpm-deck-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* Live Kinetic Rhythm Stage */
.bpm-stage {
  position: relative;
  background: #19130f;
  color: #fffaf2;
  border-radius: var(--radius);
  border: 2px solid #352b23;
  overflow: hidden;
  min-height: 256px;
  transition: border-color 120ms ease;
}
.bpm-console[data-mode="tap"] .bpm-stage {
  cursor: pointer;
}
.bpm-stage.is-downbeat {
  border-color: var(--accent);
}
.bpm-stage.is-subbeat {
  border-color: var(--accent-2);
}
.bpm-stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
.bpm-stage-hud {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 256px;
  padding: 16px 24px 16px;
  gap: 12px;
}
.bpm-screen-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.bpm-status-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.bpm-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #615245;
  flex-shrink: 0;
  transition: background 70ms ease, transform 70ms ease;
}
.bpm-led.is-pulse {
  background: var(--accent-2);
  transform: scale(1.35);
}
.bpm-led.is-accent {
  background: var(--accent);
  transform: scale(1.45);
}
.bpm-status-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: #c2b2a0;
  letter-spacing: 0.04em;
}
.bpm-stability-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius);
  background: rgba(46, 37, 29, 0.9);
  color: #e2d5c6;
  white-space: nowrap;
}
.bpm-stability-badge[data-state="locked"] {
  background: #283a20;
  color: #b9e59a;
}
.bpm-stability-badge[data-state="steady"] {
  background: #403219;
  color: var(--accent-2);
}
.bpm-stability-badge[data-state="drifting"] {
  background: #4a241a;
  color: #f6a082;
}
.bpm-readout-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 0;
}
.bpm-readout-num {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding: 8px 24px;
  border-radius: var(--radius);
  background: rgba(25, 19, 15, 0.62);
  will-change: transform;
  transform-origin: center center;
}
.bpm-big {
  font-size: 48px;
  font-weight: 700;
  color: #fffaf2;
  letter-spacing: -0.02em;
}
.bpm-dec {
  font-size: 28px;
  font-weight: 600;
  color: #bdaea0;
}
.bpm-unit {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-2);
  margin-left: 8px;
}
.bpm-screen-meta {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: var(--radius);
  background: rgba(25, 19, 15, 0.65);
  font-family: var(--font-mono);
  font-size: 14px;
  color: #d6c8b8;
}
.bpm-stage-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 250, 242, 0.1);
}
.bpm-sequencer {
  display: grid;
  grid-template-columns: repeat(4, minmax(44px, 1fr));
  gap: 8px;
  flex: 1 1 200px;
}
.bpm-seq-step {
  position: relative;
  height: 36px;
  border-radius: 8px;
  background: rgba(42, 33, 26, 0.9);
  border: 1px solid #44382d;
  color: #9e8f7e;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 80ms ease, color 80ms ease, transform 80ms ease;
}
.bpm-seq-step span {
  position: relative;
  z-index: 2;
}
.bpm-seq-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: rgba(224, 160, 58, 0.28);
  pointer-events: none;
}
.bpm-seq-step.is-accent-step .bpm-seq-fill {
  background: rgba(194, 86, 47, 0.45);
}
.bpm-seq-step.is-current {
  border-color: var(--accent-2);
  color: #fffaf2;
  transform: translateY(-1px);
}
.bpm-seq-step.is-accent-step.is-current {
  border-color: var(--accent);
}
.bpm-seq-step.is-dim {
  opacity: 0.25;
}
.bpm-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bpm-step-btn {
  appearance: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  border: 1px solid #44382d;
  background: rgba(42, 33, 26, 0.95);
  color: #fffaf2;
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
}
.bpm-step-btn:hover {
  background: #3a2d23;
  border-color: var(--accent-2);
}
.bpm-manual-input {
  width: 78px;
  height: 44px;
  border-radius: var(--radius);
  border: 1px solid #44382d;
  background: #120e0b;
  color: #fffaf2;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  padding: 0 8px;
}
.bpm-manual-input:focus {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

/* Sculpted MPC Tactile Tap Pad */
.bpm-tap-pad {
  position: relative;
  overflow: hidden;
  appearance: none;
  width: 100%;
  min-height: 144px;
  padding: 24px;
  border: 2px solid #963c1c;
  border-bottom-width: 6px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: var(--shadow-sm);
  transition: background 80ms ease, transform 60ms ease, border-bottom-width 60ms ease;
}
.bpm-tap-pad:hover {
  background: #b14b27;
}
.bpm-tap-pad.is-hit,
.bpm-tap-pad:active {
  background: #9c3f1e;
  border-bottom-width: 2px;
  transform: translateY(4px);
}
.bpm-pad-led {
  position: absolute;
  top: 12px;
  left: 16px;
  width: 28px;
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 250, 242, 0.35);
  transition: background 80ms ease;
}
.bpm-tap-pad.is-hit .bpm-pad-led,
.bpm-tap-pad.is-beat .bpm-pad-led {
  background: var(--accent-2);
}
.bpm-pad-ripple-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.bpm-ripple {
  position: absolute;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 250, 242, 0.85);
  background: rgba(224, 160, 58, 0.25);
  animation: bpmRippleOut 480ms cubic-bezier(0.12, 0.8, 0.28, 1) forwards;
}
@keyframes bpmRippleOut {
  0% { transform: scale(1); opacity: 0.95; }
  100% { transform: scale(18); opacity: 0; }
}
.bpm-tap-title {
  position: relative;
  z-index: 2;
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.bpm-tap-hint {
  position: relative;
  z-index: 2;
  font-size: 14px;
  color: #ffefe8;
}
.bpm-tap-hint kbd {
  background: rgba(25, 19, 15, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 6px;
}

/* Quick Tempo Feel Presets */
.bpm-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.bpm-presets-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-right: 4px;
}
.bpm-preset-btn {
  appearance: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  min-height: 36px;
  padding: 6px 12px;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.bpm-preset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.bpm-preset-btn.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

/* Groove Pocket Strip */
.bpm-pocket-card {
  margin-top: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.bpm-pocket-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.bpm-pocket-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.bpm-pocket-track {
  position: relative;
  height: 36px;
  background: #1e1813;
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: center;
  padding: 0 8px;
  gap: 4px;
}
.bpm-pocket-center {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(224, 160, 58, 0.38);
  pointer-events: none;
}
.bpm-pocket-slot {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bpm-pocket-bead {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #43372d;
  transition: transform 110ms ease, background 110ms ease;
}
.bpm-pocket-bead.is-tight {
  background: #8cc96e;
}
.bpm-pocket-bead.is-good {
  background: var(--accent-2);
}
.bpm-pocket-bead.is-off {
  background: var(--accent);
}

.bpm-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.bpm-ctrl {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bpm-ctrl-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.bpm-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.bpm-pattern-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 12px;
}
.bpm-seg-btn {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 6px;
  transition: background 120ms ease, color 120ms ease;
}
.bpm-seg-btn.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}
.bpm-select {
  width: 100%;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
}

/* Audio & Delay Panels */
.bpm-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 32px 24px;
  text-align: center;
  transition: border-color 140ms ease, background 140ms ease;
}
.bpm-dropzone.is-drag {
  border-color: var(--accent);
  background: #f2e6d8;
}
.bpm-drop-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 8px;
}
.bpm-drop-sub {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 16px;
}
.bpm-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 24px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.bpm-upload-btn:hover {
  background: #aa4724;
}
.bpm-audio-result {
  margin-top: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.bpm-audio-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.bpm-audio-name {
  display: block;
  font-size: 16px;
  color: var(--ink);
  word-break: break-word;
}
.bpm-audio-info {
  font-size: 14px;
  color: var(--muted);
}
.bpm-wave {
  width: 100%;
  height: 84px;
  display: block;
  border-radius: 8px;
  background: #1e1813;
  margin-bottom: 12px;
}
.bpm-audio-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.bpm-cand-btn {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 16px;
}
.bpm-cand-btn.is-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}
.bpm-audio-msg {
  font-size: 14px;
  color: var(--muted);
  margin: 12px 0 0;
  min-height: 20px;
}
.bpm-delay-head p {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
}
.bpm-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.bpm-delay-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.bpm-delay-table th,
.bpm-delay-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.bpm-delay-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: #efe7db;
}
.bpm-delay-table tbody tr:last-child td {
  border-bottom: none;
}
.bpm-copy-cell {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  padding: 4px 8px;
}
.bpm-copy-cell:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--accent);
}

/* Right Column */
.bpm-deck-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.bpm-side-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.bpm-groove-card {
  border-color: #d1bfa9;
}
.bpm-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.bpm-side-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}
.bpm-side-head .bpm-side-label {
  margin-bottom: 0;
}
.bpm-octave-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.bpm-oct-btn {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bpm-oct-btn:hover {
  border-color: var(--accent);
}
.bpm-oct-k {
  font-size: 12px;
  color: var(--muted);
}
.bpm-oct-v {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.bpm-feel-marking {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 4px;
}
.bpm-feel-genres {
  font-size: 14px;
  color: var(--muted);
}
.bpm-beat-dots {
  display: flex;
  gap: 8px;
}
.bpm-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d8ccbc;
  transition: background 70ms ease, transform 70ms ease;
}
.bpm-dot.is-on {
  background: var(--accent-2);
  transform: scale(1.3);
}
.bpm-dot.is-accent {
  background: var(--accent);
  transform: scale(1.4);
}
.bpm-metro-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.bpm-metro-btn {
  appearance: none;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.bpm-metro-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.bpm-select-sm {
  width: auto;
}
.bpm-log-actions {
  display: flex;
  gap: 12px;
}
.bpm-link-btn {
  appearance: none;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  padding: 4px;
}
.bpm-link-btn:hover {
  text-decoration: underline;
}
.bpm-log-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}
.bpm-log-input {
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 12px;
  min-width: 0;
}
.bpm-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 170px;
  overflow-y: auto;
}
.bpm-log-empty {
  font-size: 14px;
  color: var(--muted);
}
.bpm-log-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
}
.bpm-log-item-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.bpm-log-bpm {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.bpm-log-name {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bpm-log-item-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.bpm-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 40;
}
@media (prefers-reduced-motion: reduce) {
  .bpm-ripple { animation: none; opacity: 0; }
}
@media (max-width: 860px) {
  .bpm-deck {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .bpm-console {
    padding: 16px;
  }
  .bpm-stage-hud {
    padding: 16px;
  }
  .bpm-big {
    font-size: 36px;
  }
  .bpm-dec {
    font-size: 22px;
  }
  .bpm-controls-grid {
    grid-template-columns: 1fr;
  }
  .bpm-tabs,
  .bpm-bar-actions {
    width: 100%;
  }
  .bpm-tab {
    flex: 1 1 auto;
    text-align: center;
    padding: 8px 12px;
  }
  .bpm-tap-pad {
    min-height: 128px;
  }
}