:root {
  --bg: #0b0e14;
  --panel: #12161f;
  --panel-2: #181d28;
  --line: #232a38;
  --text: #e8edf5;
  --muted: #8b95a8;
  --accent: #ff7a3a;
  --accent-2: #6ee7ff;
  --pad: #c4b5fd;
  --lead: #f9a8d4;
  --drums: #34d399;
  --danger: #fb7185;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: radial-gradient(1200px 600px at 10% -10%, #1a2233 0%, var(--bg) 50%);
  color: var(--text);
  font-family: "DM Sans", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
}

button,
input,
select {
  font: inherit;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
}

button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

button:hover {
  border-color: #3a4458;
}

button.on {
  background: #2a1d14;
  border-color: var(--accent);
  color: var(--accent);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 16, 24, 0.96);
  flex-shrink: 0;
  z-index: 2;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
}

.brand strong {
  display: block;
  letter-spacing: 0.04em;
  font-size: 13px;
}

.brand input {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--muted);
  width: 140px;
}

.transport,
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.actions {
  justify-content: flex-end;
}

.play {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a0d06;
  border: 0;
  font-size: 16px;
  font-weight: 700;
}

.play.playing {
  background: var(--danger);
  color: #fff;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  min-width: 64px;
}

.field.swing input {
  width: 90px;
}

.export {
  background: var(--accent);
  color: #1a0d06;
  border: 0;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: 210px 1fr;
  flex: 1;
  min-height: 0;
}

.tracks {
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 10px;
  background: #0e121a;
}

.track {
  width: 100%;
  text-align: left;
  padding: 10px;
  margin-bottom: 8px;
  background: var(--panel);
  border-radius: 12px;
}

.track.active {
  outline: 1px solid color-mix(in srgb, var(--c) 70%, transparent);
  background: color-mix(in srgb, var(--c) 10%, var(--panel));
}

.track .name {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.track .meta {
  color: var(--muted);
  font-size: 11px;
  margin: 4px 0 8px;
}

.track .row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ms {
  width: 28px;
  padding: 4px 0;
  font-size: 11px;
  font-weight: 700;
}

.ms.lit {
  background: #3b1d24;
  color: var(--danger);
  border-color: var(--danger);
}

.track input[type="range"] {
  width: 70px;
}

.editor {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.editor-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  flex-wrap: wrap;
}

.hint {
  margin: 0 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.stage {
  position: relative;
  flex: 1;
  overflow: auto;
  background: repeating-linear-gradient(
    90deg,
    #10151e 0 64px,
    #0d1219 64px 128px
  );
}

.roll-wrap {
  position: relative;
  min-width: 900px;
}

.roll-wrap canvas {
  display: block;
}

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  pointer-events: none;
  opacity: 0.85;
  box-shadow: 0 0 10px #fff;
}

.drums {
  padding: 16px;
}

.drums h2 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}

.drum-row {
  display: grid;
  grid-template-columns: 72px repeat(16, minmax(28px, 1fr));
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
  max-width: 1100px;
}

.step {
  height: 36px;
  border-radius: 6px;
  background: #1a2130;
}

.step.on {
  background: var(--drums);
  color: #042016;
}

.step.beat {
  box-shadow: inset 0 0 0 1px #3a465c;
}

.step.now {
  outline: 2px solid #fff;
}

.rack {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: #0e121a;
  min-height: 92px;
  flex-shrink: 0;
}

.master,
.sound {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.sound .knob {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.status {
  margin: 0;
  padding: 4px 14px 8px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .topbar,
  .workspace,
  .rack {
    display: block;
  }
  .workspace {
    height: auto;
  }
  .stage {
    height: 420px;
  }
  .hint {
    display: none;
  }
}
