.harmony-panel {
    position: absolute;
    inset: 0;
    /* above the audio player and #message (z-10) while the panel is open */
    z-index: 11;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    pointer-events: none;
}

.harmony-panel__handle {
    align-self: flex-end;
    margin-bottom: 2.75rem;
    padding: 0.75rem 0.6rem;
    border-radius: 0.75rem 0 0 0.75rem;
    background: var(--color-primary);
    color: var(--color-primary-content);
    font-size: 1.25rem;
    line-height: 1;
    pointer-events: auto;
    touch-action: none;
}

.harmony-panel__handle[aria-expanded="true"] {
    margin-bottom: 0;
}

.harmony-panel__sheet {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 50%;
    overflow: hidden;
    padding: 0.5rem 0.75rem 0.75rem;
    background: var(--color-base-200);
    color: var(--color-base-content);
    box-shadow: 0 -0.5rem 1.5rem rgb(0 0 0 / 0.15);
    font-size: clamp(0.75rem, 2.2vmin, 1.1rem);
    pointer-events: auto;
    touch-action: pan-y;
    position: relative;
}

.harmony-panel__sheet[hidden] {
    display: none;
}

.harmony-panel__tabs,
.harmony-panel__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
}

.harmony-panel__content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.harmony-panel__tab {
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
}

.harmony-panel__tab[aria-selected="true"] {
    font-weight: 700;
    border-bottom-color: currentColor;
}

.harmony-panel__chip {
    min-width: 2.75rem;
    padding: 0.2rem 0.6rem;
    border: 1px solid currentColor;
    border-radius: 999px;
}

.harmony-panel__chip[aria-pressed="true"] {
    background: var(--color-primary);
    color: var(--color-primary-content);
    border-color: var(--color-primary);
}

.harmony-panel__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(max(16em, 25% - 1.25rem), 1fr));
    gap: 0.35rem 1.25rem;
}

.harmony-entry__name,
.harmony-entry__degrees {
    font-size: 0.75em;
    opacity: 0.7;
}

.harmony-entry__chords {
    font-size: 1.35em;
    font-weight: 600;
}

.harmony-entry__confirmation {
    font-size: 0.75em;
    font-weight: 400;
    opacity: 0.6;
    white-space: nowrap;
}

.harmony-chord {
    padding: 0 0.1em;
    border-radius: 0.25em;
}

.harmony-chord__seventh {
    font-size: 0.7em;
    line-height: 0;
    vertical-align: super;
}

.harmony-chord__bass {
    font-size: 0.8em;
    font-weight: 300;
    opacity: 0.5;
}

.harmony-chord:focus-visible,
.harmony-chord:active {
    background: color-mix(in oklab, var(--color-primary) 25%, transparent);
}

.harmony-panel__tooltip {
    position: absolute;
    z-index: 1;
    transform: translate(-50%, calc(-100% - 0.25rem));
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    background: var(--color-base-content);
    color: var(--color-base-100);
    white-space: nowrap;
    pointer-events: none;
}

.harmony-panel__tooltip[hidden] {
    display: none;
}

.harmony-panel__apply {
    align-self: flex-start;
}

@media (max-height: 640px), (max-width: 480px) {
    .harmony-entry__degrees {
        display: none;
    }
}
