.page-notes {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 20;
  display: grid;
  justify-items: end;
  gap: 0.45rem;
}

.page-notes .notes {
  position: relative;
  width: max-content;
}

.page-notes .notes__panel {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.45rem;
}

.notes__button {
  border: 0;
  border-radius: 0.35rem;
  background: var(--surface-muted);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.18rem 0.45rem;
}

.notes--has-content .notes__button {
  background: var(--accent-soft);
  color: var(--accent);
}

.notes__button[aria-expanded="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.page-notes__button {
  min-width: 4.25rem;
  min-height: 2.2rem;
  border-radius: 0.55rem;
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

.page-notes:hover .page-notes__button,
.page-notes:focus-within .page-notes__button,
.page-notes .notes--has-content .page-notes__button,
.page-notes__button[aria-expanded="true"] {
  opacity: 1;
}

.notes__panel {
  width: min(24rem, calc(100vw - 2rem));
  min-width: min(20rem, calc(100vw - 2rem));
  padding: 0.8rem;
  border: 1px solid var(--strong-border);
  border-radius: 0.55rem;
  background: var(--surface);
  box-shadow: 0 0.6rem 1.4rem rgb(32 37 34 / 14%);
}

.notes__label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.notes__field {
  display: block;
  width: 100%;
  min-height: 8rem;
  resize: none;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  font: inherit;
}

.block-notes {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 1;
  display: grid;
  justify-items: end;
  width: max-content;
}

.block-notes .notes {
  position: relative;
  width: max-content;
}

.block-notes .notes__button {
  min-width: 4.25rem;
}

.block-notes .notes__panel {
  position: absolute;
  right: 0;
  top: 100%;
  width: min(24rem, calc(100vw - 2rem));
  min-width: min(18rem, calc(100vw - 2rem));
  margin-top: 0.45rem;
}

@media (max-width: 760px) {
  .page-notes {
    top: 0.65rem;
    right: 0.65rem;
  }

  .page-notes__button {
    min-height: 2rem;
  }
}
