.roll {
  display: flex; max-width: 100%;
  border: 1px solid var(--stroke); border-radius: 18px; overflow: hidden;
  background: var(--panel);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.45), 0 0 0 1px rgb(0 0 0 / 0.4);
}
.keys { flex: none; width: 54px; border-right: 1px solid rgb(0 0 0 / 0.6); box-shadow: 4px 0 12px rgb(0 0 0 / 0.35); z-index: 1; }
.key {
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 7px; font: 600 10px/1 var(--font); cursor: pointer; user-select: none;
  border-bottom: 1px solid rgb(0 0 0 / 0.14);
  transition: filter 120ms;
}
.key.white { background: linear-gradient(90deg, #d9d9e2, #f4f4f8 70%, #e6e6ee); color: #3a3a4a; }
.key.black { background: linear-gradient(90deg, #26262f, #33333f 80%, #2a2a33); color: #a1a1b5; }
.key:hover { filter: brightness(1.08); }
.key:active { filter: brightness(0.8); }
.grid-wrap { overflow-x: auto; scrollbar-color: var(--line-bar) transparent; }
.grid { position: relative; touch-action: none; cursor: ns-resize; }
.row { position: absolute; left: 0; right: 0; border-bottom: 1px solid rgb(0 0 0 / 0.25); }
.row.white { background: var(--row-white); }
.row.black { background: var(--row-black); }
.vline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.vline.beat { background: var(--line-beat); }
.vline.bar { background: var(--line-bar); }

/* notes ------------------------------------------------------------------------ */
.note {
  position: absolute; border-radius: 6px;
  background: var(--note);
  background-image: linear-gradient(180deg, rgb(255 255 255 / 0.35), rgb(255 255 255 / 0) 55%);
  border: 1px solid rgb(0 0 0 / 0.35);
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.5), 0 0 12px rgb(99 230 190 / 0.25);
  transition: top 70ms ease-out, box-shadow 160ms, transform 160ms var(--spring);
  font: 600 10px/14px ui-monospace, "SF Mono", monospace; color: rgb(0 0 0 / 0.7);
  text-align: center; overflow: hidden; user-select: none;
}
/* selected: yellow plus a white ring, so it reads without color too */
.note.selected {
  background-color: var(--note-sel);
  box-shadow: 0 0 0 2px #fff, 0 0 18px 2px rgb(255 214 10 / 0.6);
  transform: scaleY(1.08);
  z-index: 2;
}
/* given / hinted: indigo with diagonal stripes */
.note.locked {
  background-color: var(--locked);
  background-image:
    repeating-linear-gradient(135deg, rgb(255 255 255 / 0.28) 0 3px, transparent 3px 7px),
    linear-gradient(180deg, rgb(255 255 255 / 0.3), rgb(255 255 255 / 0) 55%);
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.5), 0 0 12px rgb(125 122 255 / 0.3);
  cursor: default;
}
.note.locked.selected { box-shadow: 0 0 0 2px var(--note-sel), 0 0 18px 2px rgb(255 214 10 / 0.5); }
.note.ghost { background: var(--ghost); border: 1px dashed #fff8; box-shadow: none; pointer-events: none; transition: none; }

.won .note:not(.ghost) {
  background-color: var(--note-win);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.5), 0 0 20px rgb(255 214 10 / 0.7);
  animation: pop 520ms var(--spring) both;
}
.won .note:nth-of-type(3n+1) { animation-delay: 40ms; }
.won .note:nth-of-type(3n+2) { animation-delay: 90ms; }
@keyframes pop { 0% { transform: none; } 45% { transform: translateY(-5px) scale(1.15, 1.35); } 100% { transform: none; } }

.playhead {
  position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: var(--playhead); pointer-events: none; z-index: 3;
  box-shadow: 0 0 10px 2px rgb(255 55 95 / 0.6);
}
/* stopped: rests where Play will start */
.playhead.parked { opacity: 0.5; box-shadow: none; }
.playhead::before {
  content: ""; position: absolute; top: 0; left: -5px;
  border: 6px solid transparent; border-top: 8px solid var(--playhead); border-bottom: 0;
}

/* ruler: bar numbers, start position and loop region ------------------------------ */
.track { position: relative; }
.corner {
  display: block; width: 100%; padding: 0; border: 0; border-radius: 0;
  border-bottom: 1px solid rgb(0 0 0 / 0.6);
  background: linear-gradient(180deg, #262633, #1c1c27); color: var(--muted);
  font: 700 15px/1 var(--font); cursor: pointer;
  min-height: 0; box-sizing: border-box; transition: none;
}
.corner:hover:not(:disabled) { background: linear-gradient(180deg, #30303f, #242431); border-color: rgb(0 0 0 / 0.6); }
.corner:active:not(:disabled) { transform: none; }
.corner:disabled { opacity: 0.35; cursor: default; }
.corner[aria-pressed="true"], .corner[aria-pressed="true"]:hover:not(:disabled) { color: #1a1400; background: var(--note-sel); }
.ruler {
  position: relative; box-sizing: border-box; overflow: hidden; cursor: pointer; user-select: none; touch-action: none;
  background: linear-gradient(180deg, #262633, #1c1c27);
  border-bottom: 1px solid rgb(0 0 0 / 0.6);
}
.tick { position: absolute; bottom: 0; width: 1px; height: 5px; background: var(--line-bar); pointer-events: none; }
.tick.bar {
  width: 0; height: 15px; background: none; border-left: 1px solid #5a5a70;
  padding-left: 4px; font: 600 10px/11px var(--font); color: var(--muted); white-space: nowrap;
}
.cycle {
  position: absolute; top: 2px; height: 11px; border-radius: 4px; pointer-events: none;
  background: rgb(255 214 10 / 0.55); border: 1px solid var(--note-sel);
  box-shadow: 0 0 10px rgb(255 214 10 / 0.35);
}
.cycle.off { background: rgb(154 154 174 / 0.25); border-color: rgb(154 154 174 / 0.6); box-shadow: none; }
.cycle-shade {
  position: absolute; top: 0; bottom: 0; pointer-events: none; display: none;
  background: rgb(255 214 10 / 0.06);
  box-shadow: inset 1px 0 rgb(255 214 10 / 0.45), inset -1px 0 rgb(255 214 10 / 0.45);
}
