@layer components {
  /* The music notation item (#1452): a toolbar over a staff that abcjs draws as SVG. The board is
     the click target and the keyboard focus target, so it carries the focus ring. */
  .music-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-inline-size: 60rem;
  }

  .music-toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
  }

  .music-toolbar__group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .music-toolbar [aria-pressed="true"] {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-text-on-primary);
  }

  .music-board {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    min-block-size: 8rem;
    position: relative;
    user-select: none;

    &:focus-visible {
      outline: 2px solid var(--color-focus);
      outline-offset: 2px;
    }

    svg {
      display: block;
    }

    /* abcjs draws in black; the board must stay readable in dark mode. */
    svg path,
    svg text {
      fill: var(--color-text);
    }

    svg .abcjs-staff path {
      fill: var(--color-text);
    }

    .music-selected,
    .music-selected path {
      fill: var(--color-primary);
      stroke: var(--color-primary);
    }
  }

  .music-board--readonly {
    cursor: default;
  }

  /* The note the next Enter places: a ring on the staff position. */
  .music-cursor {
    block-size: 0.9rem;
    border: 2px dashed var(--color-primary);
    border-radius: 50%;
    inline-size: 1.1rem;
    margin: -0.45rem 0 0 -0.55rem;
    opacity: 0.8;
    pointer-events: none;
    position: absolute;
  }

  .music-empty {
    margin: 0;
  }
}
