/* Polyrhythm - Shape Orchestra */

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: 'Courier New', monospace;
  background: #08080e;
  color: #c8d8c8;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Scanline */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1000;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0, 0, 0, 0.05) 2px, rgba(0, 0, 0, 0.05) 4px
  );
}

canvas {
  display: block;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  cursor: crosshair;
}

/* --- Bottom toolbar --- */
.pr-toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  background: rgba(8, 8, 14, 0.88);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Controls wrapper — stacks two rows */
.pr-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

/* Each row of controls */
.pr-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Logical group of related controls */
.pr-group {
  display: flex;
  align-items: center;
  gap: 3px;
  position: relative;
}

/* Divider between groups (via gap + subtle border) */
.pr-group + .pr-group::before {
  content: '';
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.08);
  margin-right: 3px;
}

.pr-controls-hint {
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
}

/* BPM display */
.pr-bpm {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pr-bpm-val {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  min-width: 32px;
  text-align: center;
  letter-spacing: 1px;
}

.pr-bpm-val::after {
  content: ' bpm';
  font-size: 8px;
  opacity: 0.6;
}

/* Buttons */
.pr-ctrl-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  padding: 5px 10px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.12s;
  line-height: 1;
}

.pr-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
}

.pr-ctrl-btn:active {
  background: rgba(255, 255, 255, 0.12);
}

/* Labels between +/- buttons */
.pr-ctrl-label {
  font-size: 11px;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
  padding: 0 2px;
  min-width: 36px;
  text-align: center;
}

.pr-ctrl-shape {
  min-width: 60px;
  color: rgba(255, 255, 255, 0.6);
}

/* Small toggle button group (chord types, root notes, osc presets) */
.pr-chord-btns {
  display: flex;
  align-items: center;
  gap: 2px;
}

.pr-chord-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.35);
  padding: 4px 7px;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.12s;
  line-height: 1;
}

.pr-chord-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
}

.pr-chord-active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.8);
}

/* Action buttons */
.pr-actions {
  gap: 4px;
}

.pr-mute-btn {
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 10px;
  padding: 5px 10px;
}

.pr-muted {
  color: rgba(255, 80, 80, 0.5);
  border-color: rgba(255, 80, 80, 0.15);
}

.pr-del-btn {
  color: rgba(255, 80, 80, 0.4);
  border-color: rgba(255, 80, 80, 0.1);
  font-size: 14px;
  padding: 3px 8px;
}

.pr-del-btn:hover {
  color: rgba(255, 80, 80, 0.8);
  border-color: rgba(255, 80, 80, 0.3);
}

.pr-add-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.3);
  width: 28px;
  height: 28px;
  font-size: 16px;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  line-height: 1;
}

.pr-add-btn:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.06);
}

/* --- Responsive --- */

@media (max-width: 768px) {
  .pr-toolbar {
    padding: 6px 8px;
  }
  .pr-controls {
    gap: 5px;
  }
  .pr-row {
    gap: 8px;
  }
  .pr-ctrl-btn {
    padding: 5px 8px;
    font-size: 10px;
  }
  .pr-ctrl-label {
    font-size: 10px;
    min-width: 30px;
  }
  .pr-ctrl-shape {
    min-width: 52px;
  }
  .pr-chord-btn {
    padding: 4px 5px;
    font-size: 9px;
  }
}

@media (max-width: 520px) {
  .pr-toolbar {
    padding: 5px 6px;
  }
  .pr-controls {
    gap: 4px;
  }
  .pr-row {
    gap: 6px;
  }
  .pr-group + .pr-group::before {
    display: none;
  }
  .pr-ctrl-btn {
    padding: 4px 6px;
    font-size: 9px;
  }
  .pr-ctrl-label {
    font-size: 9px;
    min-width: 24px;
  }
  .pr-chord-btn {
    padding: 3px 4px;
    font-size: 8px;
  }
  .pr-add-btn {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }
}
